2
-- first, define the datatype. Turn off echoing so that expected file
3
-- does not depend on contents of hstore.sql.
5
SET client_min_messages = warning;
7
RESET client_min_messages;
8
set escape_string_warning=off;
16
select 'a=>b'::hstore;
22
select ' a=>b'::hstore;
28
select 'a =>b'::hstore;
34
select 'a=>b '::hstore;
40
select 'a=> b'::hstore;
46
select '"a"=>"b"'::hstore;
52
select ' "a"=>"b"'::hstore;
58
select '"a" =>"b"'::hstore;
64
select '"a"=>"b" '::hstore;
70
select '"a"=> "b"'::hstore;
76
select 'aa=>bb'::hstore;
82
select ' aa=>bb'::hstore;
88
select 'aa =>bb'::hstore;
94
select 'aa=>bb '::hstore;
100
select 'aa=> bb'::hstore;
106
select '"aa"=>"bb"'::hstore;
112
select ' "aa"=>"bb"'::hstore;
118
select '"aa" =>"bb"'::hstore;
124
select '"aa"=>"bb" '::hstore;
130
select '"aa"=> "bb"'::hstore;
136
select 'aa=>bb, cc=>dd'::hstore;
138
------------------------
139
"aa"=>"bb", "cc"=>"dd"
142
select 'aa=>bb , cc=>dd'::hstore;
144
------------------------
145
"aa"=>"bb", "cc"=>"dd"
148
select 'aa=>bb ,cc=>dd'::hstore;
150
------------------------
151
"aa"=>"bb", "cc"=>"dd"
154
select 'aa=>bb, "cc"=>dd'::hstore;
156
------------------------
157
"aa"=>"bb", "cc"=>"dd"
160
select 'aa=>bb , "cc"=>dd'::hstore;
162
------------------------
163
"aa"=>"bb", "cc"=>"dd"
166
select 'aa=>bb ,"cc"=>dd'::hstore;
168
------------------------
169
"aa"=>"bb", "cc"=>"dd"
172
select 'aa=>"bb", cc=>dd'::hstore;
174
------------------------
175
"aa"=>"bb", "cc"=>"dd"
178
select 'aa=>"bb" , cc=>dd'::hstore;
180
------------------------
181
"aa"=>"bb", "cc"=>"dd"
184
select 'aa=>"bb" ,cc=>dd'::hstore;
186
------------------------
187
"aa"=>"bb", "cc"=>"dd"
190
select 'aa=>null'::hstore;
196
select 'aa=>NuLl'::hstore;
202
select 'aa=>"NuLl"'::hstore;
208
select '\\=a=>q=w'::hstore;
214
select '"=a"=>q\\=w'::hstore;
220
select '"\\"a"=>q>w'::hstore;
226
select '\\"a=>q"w'::hstore;
245
select 'aa=>b, c=>d , b=>16'::hstore->'c';
251
select 'aa=>b, c=>d , b=>16'::hstore->'b';
257
select 'aa=>b, c=>d , b=>16'::hstore->'aa';
263
select ('aa=>b, c=>d , b=>16'::hstore->'gg') is null;
269
select ('aa=>NULL, c=>d , b=>16'::hstore->'aa') is null;
275
select ('aa=>"NULL", c=>d , b=>16'::hstore->'aa') is null;
282
select exist('a=>NULL, b=>qq', 'a');
288
select exist('a=>NULL, b=>qq', 'b');
294
select exist('a=>NULL, b=>qq', 'c');
300
select exist('a=>"NULL", b=>qq', 'a');
306
select defined('a=>NULL, b=>qq', 'a');
312
select defined('a=>NULL, b=>qq', 'b');
318
select defined('a=>NULL, b=>qq', 'c');
324
select defined('a=>"NULL", b=>qq', 'a');
331
select delete('a=>1 , b=>2, c=>3'::hstore, 'a');
337
select delete('a=>null , b=>2, c=>3'::hstore, 'a');
343
select delete('a=>1 , b=>2, c=>3'::hstore, 'b');
349
select delete('a=>1 , b=>2, c=>3'::hstore, 'c');
355
select delete('a=>1 , b=>2, c=>3'::hstore, 'd');
357
------------------------------
358
"a"=>"1", "b"=>"2", "c"=>"3"
362
select 'aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f';
364
-------------------------------------------
365
"b"=>"g", "aa"=>"1", "cq"=>"l", "fg"=>"f"
368
select 'aa=>1 , b=>2, cq=>3'::hstore || 'aq=>l';
370
-------------------------------------------
371
"b"=>"2", "aa"=>"1", "aq"=>"l", "cq"=>"3"
374
select 'aa=>1 , b=>2, cq=>3'::hstore || 'aa=>l';
376
--------------------------------
377
"b"=>"2", "aa"=>"l", "cq"=>"3"
380
select 'aa=>1 , b=>2, cq=>3'::hstore || '';
382
--------------------------------
383
"b"=>"2", "aa"=>"1", "cq"=>"3"
386
select ''::hstore || 'cq=>l, b=>g, fg=>f';
388
--------------------------------
389
"b"=>"g", "cq"=>"l", "fg"=>"f"
393
select 'a=>g, b=>c'::hstore || ( 'asd'=>'gf' );
395
---------------------------------
396
"a"=>"g", "b"=>"c", "asd"=>"gf"
399
select 'a=>g, b=>c'::hstore || ( 'b'=>'gf' );
401
---------------------
405
select 'a=>g, b=>c'::hstore || ( 'b'=>'NULL' );
407
-----------------------
408
"a"=>"g", "b"=>"NULL"
411
select 'a=>g, b=>c'::hstore || ( 'b'=>NULL );
413
---------------------
418
select akeys('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f');
424
select akeys('""=>1');
436
select avals('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f');
442
select avals('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>NULL');
448
select avals('""=>1');
460
select * from skeys('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f');
469
select * from skeys('""=>1');
475
select * from skeys('');
480
select * from svals('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f');
489
select *, svals is null from svals('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>NULL');
498
select * from svals('""=>1');
504
select * from svals('');
509
select * from each('aaa=>bq, b=>NULL, ""=>1 ');
518
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b';
524
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>NULL';
530
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, g=>NULL';
536
select 'a=>b, b=>1, c=>NULL'::hstore @> 'g=>NULL';
542
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>c';
548
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b';
554
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>q';
560
CREATE TABLE testhstore (h hstore);
561
\copy testhstore from 'data/hstore.data'
562
select count(*) from testhstore where h @> 'wait=>NULL';
568
select count(*) from testhstore where h @> 'wait=>CC';
574
select count(*) from testhstore where h @> 'wait=>CC, public=>t';
580
select count(*) from testhstore where h ? 'public';
586
create index hidx on testhstore using gist(h);
587
set enable_seqscan=off;
588
select count(*) from testhstore where h @> 'wait=>NULL';
594
select count(*) from testhstore where h @> 'wait=>CC';
600
select count(*) from testhstore where h @> 'wait=>CC, public=>t';
606
select count(*) from testhstore where h ? 'public';
613
create index hidx on testhstore using gin (h);
614
set enable_seqscan=off;
615
select count(*) from testhstore where h @> 'wait=>NULL';
621
select count(*) from testhstore where h @> 'wait=>CC';
627
select count(*) from testhstore where h @> 'wait=>CC, public=>t';
633
select count(*) from testhstore where h ? 'public';
639
select count(*) from (select (each(h)).key from testhstore) as wow ;
645
select key, count(*) from (select (each(h)).key from testhstore) as wow group by key order by count desc, key;