Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb17129b

Browse files
committed
Remove hstore's text[] => text[] operator.
This is not yet in any released version, so we still have the option tobacktrack. Instead, document hstore(text[], text[]). Per discussion.
1 parent3b3706d commitb17129b

File tree

4 files changed

+77
-79
lines changed

4 files changed

+77
-79
lines changed

‎contrib/hstore/expected/hstore.out

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -758,36 +758,6 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
758758
(1 row)
759759

760760
-- => arrays
761-
select ARRAY['a','b','asd'] => ARRAY['g','h','i'];
762-
?column?
763-
--------------------------------
764-
"a"=>"g", "b"=>"h", "asd"=>"i"
765-
(1 row)
766-
767-
select ARRAY['a','b','asd'] => ARRAY['g','h',NULL];
768-
?column?
769-
---------------------------------
770-
"a"=>"g", "b"=>"h", "asd"=>NULL
771-
(1 row)
772-
773-
select ARRAY['z','y','x'] => ARRAY['1','2','3'];
774-
?column?
775-
------------------------------
776-
"x"=>"3", "y"=>"2", "z"=>"1"
777-
(1 row)
778-
779-
select ARRAY['aaa','bb','c','d'] => ARRAY[null::text,null,null,null];
780-
?column?
781-
-----------------------------------------------
782-
"c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
783-
(1 row)
784-
785-
select ARRAY['aaa','bb','c','d'] => null;
786-
?column?
787-
-----------------------------------------------
788-
"c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
789-
(1 row)
790-
791761
select hstore 'aa=>1, b=>2, c=>3' => ARRAY['g','h','i'];
792762
?column?
793763
----------
@@ -812,29 +782,6 @@ select hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b','aa'];
812782
"b"=>"2", "c"=>"3", "aa"=>"1"
813783
(1 row)
814784

815-
select quote_literal('{}'::text[] => '{}'::text[]);
816-
quote_literal
817-
---------------
818-
''
819-
(1 row)
820-
821-
select quote_literal('{}'::text[] => null);
822-
quote_literal
823-
---------------
824-
''
825-
(1 row)
826-
827-
select ARRAY['a'] => '{}'::text[]; -- error
828-
ERROR: arrays must have same bounds
829-
select '{}'::text[] => ARRAY['a']; -- error
830-
ERROR: arrays must have same bounds
831-
select pg_column_size(ARRAY['a','b','asd'] => ARRAY['g','h','i'])
832-
= pg_column_size('a=>g, b=>h, asd=>i'::hstore);
833-
?column?
834-
----------
835-
t
836-
(1 row)
837-
838785
select pg_column_size(hstore 'aa=>1, b=>2, c=>3' => ARRAY['c','b'])
839786
= pg_column_size('b=>2, c=>3'::hstore);
840787
?column?
@@ -910,6 +857,60 @@ select hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
910857
"a"=>"g", "b"=>"h", "asd"=>"i"
911858
(1 row)
912859

860+
-- pairs of arrays
861+
select hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
862+
hstore
863+
--------------------------------
864+
"a"=>"g", "b"=>"h", "asd"=>"i"
865+
(1 row)
866+
867+
select hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
868+
hstore
869+
---------------------------------
870+
"a"=>"g", "b"=>"h", "asd"=>NULL
871+
(1 row)
872+
873+
select hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
874+
hstore
875+
------------------------------
876+
"x"=>"3", "y"=>"2", "z"=>"1"
877+
(1 row)
878+
879+
select hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
880+
hstore
881+
-----------------------------------------------
882+
"c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
883+
(1 row)
884+
885+
select hstore(ARRAY['aaa','bb','c','d'], null);
886+
hstore
887+
-----------------------------------------------
888+
"c"=>NULL, "d"=>NULL, "bb"=>NULL, "aaa"=>NULL
889+
(1 row)
890+
891+
select quote_literal(hstore('{}'::text[], '{}'::text[]));
892+
quote_literal
893+
---------------
894+
''
895+
(1 row)
896+
897+
select quote_literal(hstore('{}'::text[], null));
898+
quote_literal
899+
---------------
900+
''
901+
(1 row)
902+
903+
select hstore(ARRAY['a'], '{}'::text[]); -- error
904+
ERROR: arrays must have same bounds
905+
select hstore('{}'::text[], ARRAY['a']); -- error
906+
ERROR: arrays must have same bounds
907+
select pg_column_size(hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
908+
= pg_column_size('a=>g, b=>h, asd=>i'::hstore);
909+
?column?
910+
----------
911+
t
912+
(1 row)
913+
913914
-- records
914915
select hstore(v) from (values (1, 'foo', 1.2, 3::float8)) v(a,b,c,d);
915916
hstore

‎contrib/hstore/hstore.sql.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.12 2009/09/30 19:50:22 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.13 2010/06/15 19:48:30 rhaas Exp $ */
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path = public;
@@ -238,12 +238,6 @@ RETURNS hstore
238238
AS 'MODULE_PATHNAME', 'hstore_from_arrays'
239239
LANGUAGE C IMMUTABLE; -- not STRICT; allows (keys,null)
240240

241-
CREATE OPERATOR => (
242-
LEFTARG = text[],
243-
RIGHTARG = text[],
244-
PROCEDURE = hstore
245-
);
246-
247241
CREATE FUNCTION hstore(text[])
248242
RETURNS hstore
249243
AS 'MODULE_PATHNAME', 'hstore_from_array'

‎contrib/hstore/sql/hstore.sql

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,10 @@ select pg_column_size('a=>g, b=>c'::hstore || ('b'=>'gf'))
172172
= pg_column_size('a=>g, b=>gf'::hstore);
173173

174174
-- => arrays
175-
select ARRAY['a','b','asd']=> ARRAY['g','h','i'];
176-
select ARRAY['a','b','asd']=> ARRAY['g','h',NULL];
177-
select ARRAY['z','y','x']=> ARRAY['1','2','3'];
178-
select ARRAY['aaa','bb','c','d']=> ARRAY[null::text,null,null,null];
179-
select ARRAY['aaa','bb','c','d']=>null;
180175
select hstore'aa=>1, b=>2, c=>3'=> ARRAY['g','h','i'];
181176
select hstore'aa=>1, b=>2, c=>3'=> ARRAY['c','b'];
182177
select hstore'aa=>1, b=>2, c=>3'=> ARRAY['aa','b'];
183178
select hstore'aa=>1, b=>2, c=>3'=> ARRAY['c','b','aa'];
184-
select quote_literal('{}'::text[]=>'{}'::text[]);
185-
select quote_literal('{}'::text[]=>null);
186-
select ARRAY['a']=>'{}'::text[];-- error
187-
select'{}'::text[]=> ARRAY['a'];-- error
188-
select pg_column_size(ARRAY['a','b','asd']=> ARRAY['g','h','i'])
189-
= pg_column_size('a=>g, b=>h, asd=>i'::hstore);
190179
select pg_column_size(hstore'aa=>1, b=>2, c=>3'=> ARRAY['c','b'])
191180
= pg_column_size('b=>2, c=>3'::hstore);
192181
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']]]);
208197
select hstore('[0:5]={a,g,b,h,asd,i}'::text[]);
209198
select hstore('[0:2][1:2]={{a,g},{b,h},{asd,i}}'::text[]);
210199

200+
-- pairs of arrays
201+
select hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']);
202+
select hstore(ARRAY['a','b','asd'], ARRAY['g','h',NULL]);
203+
select hstore(ARRAY['z','y','x'], ARRAY['1','2','3']);
204+
select hstore(ARRAY['aaa','bb','c','d'], ARRAY[null::text,null,null,null]);
205+
select hstore(ARRAY['aaa','bb','c','d'],null);
206+
select quote_literal(hstore('{}'::text[],'{}'::text[]));
207+
select quote_literal(hstore('{}'::text[],null));
208+
select hstore(ARRAY['a'],'{}'::text[]);-- error
209+
select hstore('{}'::text[], ARRAY['a']);-- error
210+
select pg_column_size(hstore(ARRAY['a','b','asd'], ARRAY['g','h','i']))
211+
= pg_column_size('a=>g, b=>h, asd=>i'::hstore);
212+
211213
-- records
212214
select hstore(v)from (values (1,'foo',1.2,3::float8)) v(a,b,c,d);
213215
createdomainhstestdom1asintegernot null default0;

‎doc/src/sgml/hstore.sgml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.8 2010/02/27 04:29:44 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/hstore.sgml,v 1.9 2010/06/15 19:48:30 rhaas Exp $ -->
22

33
<sect1 id="hstore">
44
<title>hstore</title>
@@ -120,13 +120,6 @@
120120
<entry><literal>"a"=&gt;"b"</literal></entry>
121121
</row>
122122

123-
<row>
124-
<entry><type>text[]</> <literal>=&gt;</> <type>text[]</></entry>
125-
<entry>construct an <type>hstore</> from separate key and value arrays</entry>
126-
<entry><literal>ARRAY['a','b'] =&gt; ARRAY['1','2']</literal></entry>
127-
<entry><literal>"a"=&gt;"1","b"=&gt;"2"</literal></entry>
128-
</row>
129-
130123
<row>
131124
<entry><type>hstore</> <literal>=&gt;</> <type>text[]</></entry>
132125
<entry>extract a subset of an <type>hstore</></entry>
@@ -264,6 +257,14 @@
264257
<entry><literal>a=&gt;1, b=&gt;2, c=&gt;3, d=&gt;4</literal></entry>
265258
</row>
266259

260+
<row>
261+
<entry><function>hstore(text[], text[])</function></entry>
262+
<entry><type>hstore</type></entry>
263+
<entry>construct an <type>hstore</> from separate key and value arrays</entry>
264+
<entry><literal>hstore(ARRAY['a','b'], ARRAY['1','2'])</literal></entry>
265+
<entry><literal>"a"=&gt;"1","b"=&gt;"2"</literal></entry>
266+
</row>
267+
267268
<row>
268269
<entry><function>akeys(hstore)</function></entry>
269270
<entry><type>text[]</type></entry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp