Rename hstore => text[] operator to %

This is not yet in any released version, so we still have the option to
change the name.  We may want to reserve the token => in a future release.
This commit is contained in:
Robert Haas 2010-06-18 03:52:03 +00:00
parent 78e8f0025e
commit 31c47e53aa
5 changed files with 21 additions and 22 deletions

View File

@ -757,39 +757,39 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
t
(1 row)
-- => arrays
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['g','h','i'];
-- %
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['g','h','i'];
?column?
----------
(1 row)
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b'];
?column?
--------------------
"b"=>"2", "c"=>"3"
(1 row)
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['aa','b'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['aa','b'];
?column?
---------------------
"b"=>"2", "aa"=>"1"
(1 row)
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b','aa'];
?column?
-------------------------------
"b"=>"2", "c"=>"3", "aa"=>"1"
(1 row)
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b'])
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b'])
= pg_column_size('b=>2, c=>3'::hstore);
?column?
----------
t
(1 row)
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'])
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b','aa'])
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
?column?
----------

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.13 2010/06/15 19:48:30 rhaas Exp $ */
/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.14 2010/06/18 03:52:02 rhaas Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@ -66,7 +66,7 @@ RETURNS hstore
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR => (
CREATE OPERATOR % (
LEFTARG = hstore,
RIGHTARG = text[],
PROCEDURE = slice_hstore

View File

@ -171,14 +171,14 @@ select pg_column_size(('b'=>'gf'))
select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
= pg_column_size('a=>g, b=>gf'::hstore);
-- => arrays
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['g','h','i'];
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b'];
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['aa','b'];
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'];
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b'])
-- %
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['g','h','i'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['aa','b'];
select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b','aa'];
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b'])
= pg_column_size('b=>2, c=>3'::hstore);
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'])
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b','aa'])
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
-- array input

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/hstore/uninstall_hstore.sql,v 1.9 2009/09/30 19:50:22 tgl Exp $ */
/* $PostgreSQL: pgsql/contrib/hstore/uninstall_hstore.sql,v 1.10 2010/06/18 03:52:02 rhaas Exp $ */
-- Adjust this setting to control where the objects get dropped.
SET search_path = public;
@ -22,8 +22,7 @@ DROP OPERATOR <@ ( hstore, hstore );
DROP OPERATOR @ ( hstore, hstore );
DROP OPERATOR ~ ( hstore, hstore );
DROP OPERATOR => ( text, text );
DROP OPERATOR => ( text[], text[] );
DROP OPERATOR => ( hstore, text[] );
DROP OPERATOR % ( hstore, text[] );
DROP OPERATOR #= ( anyelement, hstore );
DROP OPERATOR %% ( NONE, hstore );
DROP OPERATOR %# ( NONE, hstore );

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.9 2010/06/15 19:48:30 rhaas Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.10 2010/06/18 03:52:03 rhaas Exp $ -->
<sect1 id="hstore">
<title>hstore</title>
@ -121,9 +121,9 @@
</row>
<row>
<entry><type>hstore</> <literal>=&gt;</> <type>text[]</></entry>
<entry><type>hstore</> <literal>%</> <type>text[]</></entry>
<entry>extract a subset of an <type>hstore</></entry>
<entry><literal>'a=&gt;1,b=&gt;2,c=&gt;3'::hstore =&gt; ARRAY['b','c','x']</literal></entry>
<entry><literal>'a=&gt;1,b=&gt;2,c=&gt;3'::hstore % ARRAY['b','c','x']</literal></entry>
<entry><literal>"b"=&gt;"2", "c"=&gt;"3"</literal></entry>
</row>