hstore_slice.patch
application/octet-stream
Filename: hstore_slice.patch
Type: application/octet-stream
Part: 0
Message:
Re: hstore ==> and deprecate =>
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| contrib/hstore/expected/hstore.out | 0 | 0 |
| contrib/hstore/hstore.sql.in | 0 | 0 |
| contrib/hstore/sql/hstore.sql | 0 | 0 |
| contrib/hstore/uninstall_hstore.sql | 0 | 0 |
| doc/src/sgml/hstore.sgml | 0 | 0 |
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 9f15a9b..e78264d 100644
*** a/contrib/hstore/expected/hstore.out
--- b/contrib/hstore/expected/hstore.out
***************
*** 4,10 ****
--
SET client_min_messages = warning;
\set ECHO none
! psql:hstore.sql:234: 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;
--- 4,10 ----
--
SET client_min_messages = warning;
\set ECHO none
! 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;
*************** select pg_column_size('a=>g, b=>c'::hsto
*** 759,797 ****
t
(1 row)
! -- %
! 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'];
! ?column?
--------------------
"b"=>"2", "c"=>"3"
(1 row)
! 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'];
! ?column?
-------------------------------
"b"=>"2", "c"=>"3", "aa"=>"1"
(1 row)
! 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'])
= pg_column_size('aa=>1, b=>2, c=>3'::hstore);
?column?
----------
--- 759,797 ----
t
(1 row)
! -- slice()
! select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['g','h','i']);
! slice
! -------
(1 row)
! select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
! slice
--------------------
"b"=>"2", "c"=>"3"
(1 row)
! select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
! slice
---------------------
"b"=>"2", "aa"=>"1"
(1 row)
! 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(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(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 f77e562..0862cf1 100644
*** a/contrib/hstore/hstore.sql.in
--- b/contrib/hstore/hstore.sql.in
*************** CREATE OPERATOR -> (
*** 61,77 ****
PROCEDURE = slice_array
);
! CREATE OR REPLACE FUNCTION slice_hstore(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'
--- 61,71 ----
PROCEDURE = slice_array
);
! CREATE OR REPLACE FUNCTION slice(hstore,text[])
RETURNS hstore
AS 'MODULE_PATHNAME','hstore_slice_to_hstore'
LANGUAGE C STRICT IMMUTABLE;
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 a066f11..8fefcbb 100644
*** a/contrib/hstore/sql/hstore.sql
--- b/contrib/hstore/sql/hstore.sql
*************** select pg_column_size(('b'=>'gf'))
*** 171,184 ****
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'])
= pg_column_size('b=>2, c=>3'::hstore);
! 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
--- 171,184 ----
select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
= pg_column_size('a=>g, b=>gf'::hstore);
! -- 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(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 651846d..71dffc2 100644
*** a/contrib/hstore/uninstall_hstore.sql
--- b/contrib/hstore/uninstall_hstore.sql
*************** DROP OPERATOR <@ ( hstore, hstore );
*** 22,28 ****
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 );
--- 22,27 ----
*************** DROP FUNCTION hstore_le(hstore,hstore);
*** 44,50 ****
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 fetchval(hstore,text);
DROP FUNCTION isexists(hstore,text);
DROP FUNCTION exist(hstore,text);
--- 43,49 ----
DROP FUNCTION hstore_cmp(hstore,hstore);
DROP FUNCTION hstore_hash(hstore);
DROP FUNCTION slice_array(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 a774d51..e02d478 100644
*** a/doc/src/sgml/hstore.sgml
--- b/doc/src/sgml/hstore.sgml
***************
*** 83,89 ****
</sect2>
<sect2>
! <title><type>hstore</> Operators and Functions</title>
<table id="hstore-op-table">
<title><type>hstore</> Operators</title>
--- 83,89 ----
</sect2>
<sect2>
! <title><type>hstore</> Operators</title>
<table id="hstore-op-table">
<title><type>hstore</> Operators</title>
***************
*** 121,133 ****
</row>
<row>
- <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>"b"=>"2", "c"=>"3"</literal></entry>
- </row>
-
- <row>
<entry><type>hstore</> <literal>||</> <type>hstore</></entry>
<entry>concatenate <type>hstore</>s</entry>
<entry><literal>'a=>b, c=>d'::hstore || 'c=>x, d=>q'::hstore</literal></entry>
--- 121,126 ----
*************** b
*** 339,344 ****
--- 332,345 ----
</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=>1,b=>2,c=>3'::hstore, ARRAY['b','c','x'])</literal></entry>
+ <entry><literal>"b"=>"2", "c"=>"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>