mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-03 08:00:21 +08:00
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:
parent
78e8f0025e
commit
31c47e53aa
@ -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?
|
||||
----------
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
@ -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>=></> <type>text[]</></entry>
|
||||
<entry><type>hstore</> <literal>%</> <type>text[]</></entry>
|
||||
<entry>extract a subset of an <type>hstore</></entry>
|
||||
<entry><literal>'a=>1,b=>2,c=>3'::hstore => ARRAY['b','c','x']</literal></entry>
|
||||
<entry><literal>'a=>1,b=>2,c=>3'::hstore % ARRAY['b','c','x']</literal></entry>
|
||||
<entry><literal>"b"=>"2", "c"=>"3"</literal></entry>
|
||||
</row>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user