aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-07-02 20:36:49 +0000
committerRobert Haas <rhaas@postgresql.org>2010-07-02 20:36:49 +0000
commitce5174767370d25535f800c3b0a9bdb37b66a95c (patch)
treee012d16d1ccffbe038a6a05d95887bd735f45284
parentbb0fe9feb9fd75a6aaa960028a9f810c883b0fc4 (diff)
downloadpostgresql-ce5174767370d25535f800c3b0a9bdb37b66a95c.tar.gz
postgresql-ce5174767370d25535f800c3b0a9bdb37b66a95c.zip
Remove hstore % text[] operator; use slice() function instead.
David Wheeler, with one small correction by me.
-rw-r--r--contrib/hstore/expected/hstore.out26
-rw-r--r--contrib/hstore/hstore.sql.in10
-rw-r--r--contrib/hstore/sql/hstore.sql14
-rw-r--r--contrib/hstore/uninstall_hstore.sql5
-rw-r--r--doc/src/sgml/hstore.sgml17
5 files changed, 33 insertions, 39 deletions
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 9f15a9be6c4..e78264d12bc 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -4,7 +4,7 @@
--
SET client_min_messages = warning;
\set ECHO none
-psql:hstore.sql:234: WARNING: => is deprecated as an operator name
+psql:hstore.sql:228: WARNING: => is deprecated as an operator name
DETAIL: This name may be disallowed altogether in future versions of PostgreSQL.
RESET client_min_messages;
set escape_string_warning=off;
@@ -759,39 +759,39 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
t
(1 row)
--- %
-select hstore 'aa=>1, b=>2, c=>3' % ARRAY['g','h','i'];
- ?column?
-----------
+-- slice()
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['g','h','i']);
+ slice
+-------
(1 row)
-select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b'];
- ?column?
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
+ slice
--------------------
"b"=>"2", "c"=>"3"
(1 row)
-select hstore 'aa=>1, b=>2, c=>3' % ARRAY['aa','b'];
- ?column?
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
+ slice
---------------------
"b"=>"2", "aa"=>"1"
(1 row)
-select hstore 'aa=>1, b=>2, c=>3' % ARRAY['c','b','aa'];
- ?column?
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
+ slice
-------------------------------
"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(slice(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(slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']))
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
?column?
----------
diff --git a/contrib/hstore/hstore.sql.in b/contrib/hstore/hstore.sql.in
index 3cf4178afbd..c7a5e8e5562 100644
--- a/contrib/hstore/hstore.sql.in
+++ b/contrib/hstore/hstore.sql.in
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.14 2010/06/18 03:52:02 rhaas Exp $ */
+/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.15 2010/07/02 20:36:48 rhaas Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@@ -61,17 +61,11 @@ CREATE OPERATOR -> (
PROCEDURE = slice_array
);
-CREATE OR REPLACE FUNCTION slice_hstore(hstore,text[])
+CREATE OR REPLACE FUNCTION slice(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
LANGUAGE C STRICT IMMUTABLE;
-CREATE OPERATOR % (
- LEFTARG = hstore,
- RIGHTARG = text[],
- PROCEDURE = slice_hstore
-);
-
CREATE OR REPLACE FUNCTION isexists(hstore,text)
RETURNS bool
AS 'MODULE_PATHNAME','hstore_exists'
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index a066f11b2bb..8fefcbba93a 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -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);
--- %
-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'])
+-- slice()
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['g','h','i']);
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
+select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
+select pg_column_size(slice(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(slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']))
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
-- array input
diff --git a/contrib/hstore/uninstall_hstore.sql b/contrib/hstore/uninstall_hstore.sql
index 468bfb3c964..ca2b05aa835 100644
--- a/contrib/hstore/uninstall_hstore.sql
+++ b/contrib/hstore/uninstall_hstore.sql
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/hstore/uninstall_hstore.sql,v 1.10 2010/06/18 03:52:02 rhaas Exp $ */
+/* $PostgreSQL: pgsql/contrib/hstore/uninstall_hstore.sql,v 1.11 2010/07/02 20:36:48 rhaas Exp $ */
-- Adjust this setting to control where the objects get dropped.
SET search_path = public;
@@ -22,7 +22,6 @@ DROP OPERATOR <@ ( hstore, hstore );
DROP OPERATOR @ ( hstore, hstore );
DROP OPERATOR ~ ( hstore, hstore );
DROP OPERATOR => ( text, text );
-DROP OPERATOR % ( hstore, text[] );
DROP OPERATOR #= ( anyelement, hstore );
DROP OPERATOR %% ( NONE, hstore );
DROP OPERATOR %# ( NONE, hstore );
@@ -44,7 +43,7 @@ DROP FUNCTION hstore_le(hstore,hstore);
DROP FUNCTION hstore_cmp(hstore,hstore);
DROP FUNCTION hstore_hash(hstore);
DROP FUNCTION slice_array(hstore,text[]);
-DROP FUNCTION slice_hstore(hstore,text[]);
+DROP FUNCTION slice(hstore,text[]);
DROP FUNCTION fetchval(hstore,text);
DROP FUNCTION isexists(hstore,text);
DROP FUNCTION exist(hstore,text);
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index ef09a4ca869..c5effb88e05 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.11 2010/06/22 11:36:16 rhaas Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.12 2010/07/02 20:36:49 rhaas Exp $ -->
<sect1 id="hstore">
<title>hstore</title>
@@ -121,13 +121,6 @@
</row>
<row>
- <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 % ARRAY['b','c','x']</literal></entry>
- <entry><literal>"b"=&gt;"2", "c"=&gt;"3"</literal></entry>
- </row>
-
- <row>
<entry><type>hstore</> <literal>||</> <type>hstore</></entry>
<entry>concatenate <type>hstore</>s</entry>
<entry><literal>'a=&gt;b, c=&gt;d'::hstore || 'c=&gt;x, d=&gt;q'::hstore</literal></entry>
@@ -339,6 +332,14 @@ b
</row>
<row>
+ <entry><function>slice(hstore, text[])</function></entry>
+ <entry><type>hstore</type></entry>
+ <entry>extract a subset of an <type>hstore</></entry>
+ <entry><literal>slice('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>
+
+ <row>
<entry><function>each(hstore)</function></entry>
<entry><type>setof(key text, value text)</type></entry>
<entry>get <type>hstore</>'s keys and values as a set</entry>