hstore_remove_array_constructor_arrow.patch
application/octet-stream
Filename: hstore_remove_array_constructor_arrow.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 | 54 | 53 |
| contrib/hstore/hstore.sql.in | 0 | 6 |
| contrib/hstore/sql/hstore.sql | 13 | 11 |
| doc/src/sgml/hstore.sgml | 8 | 7 |
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 34db7f5..6a26bc1 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -758,36 +758,6 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
(1 row)
-- => arrays
-select ARRAY['a','b','asd'] => ARRAY['g','h','i'];
- ?column?
---------------------------------
- "a"=>"g", "b"=>"h", "asd"=>"i"
-(1 row)
-
-select ARRAY['a','b','asd'] => ARRAY['g','h',NULL];
- ?column?
----------------------------------
- "a"=>"g", "b"=>"h", "asd"=>NULL
-(1 row)
-
-select ARRAY['z','y','x'] => ARRAY['1','2','3'];
- ?column?
-------------------------------
- "x"=>"3", "y"=>"2", "z"=>"1"
-(1 row)
-
-select ARRAY['aaa','bb','c','d'] => ARRAY[null::text,null,null,null];
- ?column?
------------------------------------------------
- "c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
-(1 row)
-
-select ARRAY['aaa','bb','c','d'] => null;
- ?column?
------------------------------------------------
- "c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
-(1 row)
-
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['g','h','i'];
?column?
----------
@@ -812,29 +782,6 @@ select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'];
"b"=>"2", "c"=>"3", "aa"=>"1"
(1 row)
-select quote_literal('{}'::text[] => '{}'::text[]);
- quote_literal
----------------
- ''
-(1 row)
-
-select quote_literal('{}'::text[] => null);
- quote_literal
----------------
- ''
-(1 row)
-
-select ARRAY['a'] => '{}'::text[]; -- error
-ERROR: arrays must have same bounds
-select '{}'::text[] => ARRAY['a']; -- error
-ERROR: arrays must have same bounds
-select pg_column_size(ARRAY['a','b','asd'] => ARRAY['g','h','i'])
- = pg_column_size('a=>g, b=>h, asd=>i'::hstore);
- ?column?
-----------
- t
-(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?
@@ -910,6 +857,60 @@ select hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
"a"=>"g", "b"=>"h", "asd"=>"i"
(1 row)
+-- pairs of arrays
+select hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
+ hstore
+--------------------------------
+ "a"=>"g", "b"=>"h", "asd"=>"i"
+(1 row)
+
+select hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
+ hstore
+---------------------------------
+ "a"=>"g", "b"=>"h", "asd"=>NULL
+(1 row)
+
+select hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
+ hstore
+------------------------------
+ "x"=>"3", "y"=>"2", "z"=>"1"
+(1 row)
+
+select hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
+ hstore
+-----------------------------------------------
+ "c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
+(1 row)
+
+select hstore(ARRAY['aaa','bb','c','d'], null);
+ hstore
+-----------------------------------------------
+ "c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
+(1 row)
+
+select quote_literal(hstore('{}'::text[], '{}'::text[]));
+ quote_literal
+---------------
+ ''
+(1 row)
+
+select quote_literal(hstore('{}'::text[], null));
+ quote_literal
+---------------
+ ''
+(1 row)
+
+select hstore(ARRAY['a'], '{}'::text[]); -- error
+ERROR: arrays must have same bounds
+select hstore('{}'::text[], ARRAY['a']); -- error
+ERROR: arrays must have same bounds
+select pg_column_size(hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
+ = pg_column_size('a=>g, b=>h, asd=>i'::hstore);
+ ?column?
+----------
+ t
+(1 row)
+
-- records
select hstore(v) from (values (1, 'foo', 1.2, 3::float8)) v(a,b,c,d);
hstore
diff --git a/contrib/hstore/hstore.sql.in b/contrib/hstore/hstore.sql.in
index 972557a..aa33829 100644
--- a/contrib/hstore/hstore.sql.in
+++ b/contrib/hstore/hstore.sql.in
@@ -238,12 +238,6 @@ RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_arrays'
LANGUAGE C IMMUTABLE; -- not STRICT; allows (keys,null)
-CREATE OPERATOR => (
- LEFTARG = text[],
- RIGHTARG = text[],
- PROCEDURE = hstore
-);
-
CREATE FUNCTION hstore(text[])
RETURNS hstore
AS 'MODULE_PATHNAME', 'hstore_from_array'
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index a88ff1d..190d7a2 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -172,21 +172,10 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
= pg_column_size('a=>g, b=>gf'::hstore);
-- => arrays
-select ARRAY['a','b','asd'] => ARRAY['g','h','i'];
-select ARRAY['a','b','asd'] => ARRAY['g','h',NULL];
-select ARRAY['z','y','x'] => ARRAY['1','2','3'];
-select ARRAY['aaa','bb','c','d'] => ARRAY[null::text,null,null,null];
-select ARRAY['aaa','bb','c','d'] => null;
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 quote_literal('{}'::text[] => '{}'::text[]);
-select quote_literal('{}'::text[] => null);
-select ARRAY['a'] => '{}'::text[]; -- error
-select '{}'::text[] => ARRAY['a']; -- error
-select pg_column_size(ARRAY['a','b','asd'] => ARRAY['g','h','i'])
- = pg_column_size('a=>g, b=>h, asd=>i'::hstore);
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'])
@@ -208,6 +197,19 @@ select hstore(ARRAY[[['a','g'],['b','h'],['asd','i']]]);
select hstore('[0:5]={a,g,b,h,asd,i}'::text[]);
select hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
+-- pairs of arrays
+select hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
+select hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
+select hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
+select hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
+select hstore(ARRAY['aaa','bb','c','d'], null);
+select quote_literal(hstore('{}'::text[], '{}'::text[]));
+select quote_literal(hstore('{}'::text[], null));
+select hstore(ARRAY['a'], '{}'::text[]); -- error
+select hstore('{}'::text[], ARRAY['a']); -- error
+select pg_column_size(hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
+ = pg_column_size('a=>g, b=>h, asd=>i'::hstore);
+
-- records
select hstore(v) from (values (1, 'foo', 1.2, 3::float8)) v(a,b,c,d);
create domain hstestdom1 as integer not null default 0;
diff --git a/doc/src/sgml/hstore.sgml b/doc/src/sgml/hstore.sgml
index 65be452..d65a487 100644
--- a/doc/src/sgml/hstore.sgml
+++ b/doc/src/sgml/hstore.sgml
@@ -121,13 +121,6 @@
</row>
<row>
- <entry><type>text[]</> <literal>=></> <type>text[]</></entry>
- <entry>construct an <type>hstore</> from separate key and value arrays</entry>
- <entry><literal>ARRAY['a','b'] => ARRAY['1','2']</literal></entry>
- <entry><literal>"a"=>"1","b"=>"2"</literal></entry>
- </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>
@@ -265,6 +258,14 @@
</row>
<row>
+ <entry><function>hstore(text[], text[])</function></entry>
+ <entry><type>hstore</type></entry>
+ <entry>construct an <type>hstore</> from separate key and value arrays</entry>
+ <entry><literal>hstore(ARRAY['a','b'], ARRAY['1','2'])</literal></entry>
+ <entry><literal>"a"=>"1","b"=>"2"</literal></entry>
+ </row>
+
+ <row>
<entry><function>akeys(hstore)</function></entry>
<entry><type>text[]</type></entry>
<entry>get <type>hstore</>'s keys as an array</entry>