@@ -272,6 +272,12 @@ select ('aa=>NULL, c=>d , b=>16'::hstore->'aa') is null;
272
272
t
273
273
(1 row)
274
274
275
+ select ('aa=>"NULL", c=>d , b=>16'::hstore->'aa') is null;
276
+ ?column?
277
+ ----------
278
+ f
279
+ (1 row)
280
+
275
281
-- exists/defined
276
282
select exist('a=>NULL, b=>qq', 'a');
277
283
exist
@@ -291,6 +297,12 @@ select exist('a=>NULL, b=>qq', 'c');
291
297
f
292
298
(1 row)
293
299
300
+ select exist('a=>"NULL", b=>qq', 'a');
301
+ exist
302
+ -------
303
+ t
304
+ (1 row)
305
+
294
306
select defined('a=>NULL, b=>qq', 'a');
295
307
defined
296
308
---------
@@ -309,6 +321,12 @@ select defined('a=>NULL, b=>qq', 'c');
309
321
f
310
322
(1 row)
311
323
324
+ select defined('a=>"NULL", b=>qq', 'a');
325
+ defined
326
+ ---------
327
+ t
328
+ (1 row)
329
+
312
330
-- delete
313
331
select delete('a=>1 , b=>2, c=>3'::hstore, 'a');
314
332
delete
@@ -384,6 +402,18 @@ select 'a=>g, b=>c'::hstore || ( 'b'=>'gf' );
384
402
"a"=>"g", "b"=>"gf"
385
403
(1 row)
386
404
405
+ select 'a=>g, b=>c'::hstore || ( 'b'=>'NULL' );
406
+ ?column?
407
+ -----------------------
408
+ "a"=>"g", "b"=>"NULL"
409
+ (1 row)
410
+
411
+ select 'a=>g, b=>c'::hstore || ( 'b'=>NULL );
412
+ ?column?
413
+ ---------------------
414
+ "a"=>"g", "b"=>NULL
415
+ (1 row)
416
+
387
417
-- keys/values
388
418
select akeys('aa=>1 , b=>2, cq=>3'::hstore || 'cq=>l, b=>g, fg=>f');
389
419
akeys
@@ -485,19 +515,19 @@ select * from each('aaa=>bq, b=>NULL, ""=>1 ');
485
515
(3 rows)
486
516
487
517
-- @>
488
- select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL ';
518
+ select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b ';
489
519
?column?
490
520
----------
491
521
t
492
522
(1 row)
493
523
494
- select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL , c=>NULL';
524
+ select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b , c=>NULL';
495
525
?column?
496
526
----------
497
527
t
498
528
(1 row)
499
529
500
- select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>NULL , g=>NULL';
530
+ select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b , g=>NULL';
501
531
?column?
502
532
----------
503
533
f
@@ -521,12 +551,6 @@ select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b';
521
551
t
522
552
(1 row)
523
553
524
- select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>NULL';
525
- ?column?
526
- ----------
527
- t
528
- (1 row)
529
-
530
554
select 'a=>b, b=>1, c=>NULL'::hstore @> 'a=>b, c=>q';
531
555
?column?
532
556
----------
@@ -538,7 +562,7 @@ CREATE TABLE testhstore (h hstore);
538
562
select count(*) from testhstore where h @> 'wait=>NULL';
539
563
count
540
564
-------
541
- 189
565
+ 1
542
566
(1 row)
543
567
544
568
select count(*) from testhstore where h @> 'wait=>CC';
@@ -553,12 +577,18 @@ select count(*) from testhstore where h @> 'wait=>CC, public=>t';
553
577
2
554
578
(1 row)
555
579
580
+ select count(*) from testhstore where h ? 'public';
581
+ count
582
+ -------
583
+ 194
584
+ (1 row)
585
+
556
586
create index hidx on testhstore using gist(h);
557
587
set enable_seqscan=off;
558
588
select count(*) from testhstore where h @> 'wait=>NULL';
559
589
count
560
590
-------
561
- 189
591
+ 1
562
592
(1 row)
563
593
564
594
select count(*) from testhstore where h @> 'wait=>CC';
@@ -573,26 +603,59 @@ select count(*) from testhstore where h @> 'wait=>CC, public=>t';
573
603
2
574
604
(1 row)
575
605
606
+ select count(*) from testhstore where h ? 'public';
607
+ count
608
+ -------
609
+ 194
610
+ (1 row)
611
+
612
+ drop index hidx;
613
+ create index hidx on testhstore using gin (h);
614
+ set enable_seqscan=off;
615
+ select count(*) from testhstore where h @> 'wait=>NULL';
616
+ count
617
+ -------
618
+ 1
619
+ (1 row)
620
+
621
+ select count(*) from testhstore where h @> 'wait=>CC';
622
+ count
623
+ -------
624
+ 15
625
+ (1 row)
626
+
627
+ select count(*) from testhstore where h @> 'wait=>CC, public=>t';
628
+ count
629
+ -------
630
+ 2
631
+ (1 row)
632
+
633
+ select count(*) from testhstore where h ? 'public';
634
+ count
635
+ -------
636
+ 194
637
+ (1 row)
638
+
576
639
select count(*) from (select (each(h)).key from testhstore) as wow ;
577
640
count
578
641
-------
579
- 4779
642
+ 4781
580
643
(1 row)
581
644
582
645
select key, count(*) from (select (each(h)).key from testhstore) as wow group by key order by count desc, key;
583
646
key | count
584
647
-----------+-------
585
- line | 883
648
+ line | 884
586
649
query | 207
587
650
pos | 203
588
651
node | 202
589
652
space | 197
590
653
status | 195
591
654
public | 194
592
655
title | 190
656
+ wait | 190
593
657
org | 189
594
658
user | 189
595
- wait | 189
596
659
coauthors | 188
597
660
disabled | 185
598
661
indexed | 184
0 commit comments