1 SELECT '"foo"=>true'::hstore;
7 SELECT 'foo=>true'::hstore;
13 SELECT '"true"=>true'::hstore;
19 SELECT 'true=>true'::hstore;
25 SELECT '"t"=>true'::hstore;
31 SELECT 't=>true'::hstore;
37 SELECT '"false"=>true'::hstore;
43 SELECT 'false=>true'::hstore;
49 SELECT '"f"=>true'::hstore;
55 SELECT 'f=>true'::hstore;
61 SELECT '"foo"=>false'::hstore;
67 SELECT 'foo=>false'::hstore;
73 SELECT '"false"=>false'::hstore;
79 SELECT 'false=>false'::hstore;
85 SELECT '"t"=>false'::hstore;
91 SELECT 't=>false'::hstore;
97 SELECT '"false"=>false'::hstore;
103 SELECT 'false=>false'::hstore;
109 SELECT '"f"=>false'::hstore;
115 SELECT 'f=>false'::hstore;
121 SELECT '"1"=>x'::hstore;
127 SELECT '1=>x'::hstore;
133 SELECT 'foo=>1'::hstore;
139 SELECT 'foo=>1.'::hstore;
145 SELECT 'foo=>1.0'::hstore;
151 SELECT 'foo=>1.01'::hstore;
157 SELECT 'foo=>1.01e'::hstore;
163 SELECT 'foo=>1.01e1'::hstore;
169 SELECT 'foo=>1.01e+1'::hstore;
175 SELECT 'foo=>1.01e-1'::hstore;
181 SELECT 'foo=>.1'::hstore;
187 SELECT 'foo=>.1e'::hstore;
193 SELECT 'foo=>.1e1'::hstore;
199 SELECT 'foo=>.1e+1'::hstore;
205 SELECT 'foo=>.1e-1'::hstore;
211 SELECT 'foo=>0.1e-1'::hstore;
217 SELECT 'foo=>00.1e-1'::hstore;
223 SELECT 'foo=>+1'::hstore;
229 SELECT 'foo=>+1.'::hstore;
235 SELECT 'foo=>+1.0'::hstore;
241 SELECT 'foo=>+1.01'::hstore;
247 SELECT 'foo=>+1.01e'::hstore;
253 SELECT 'foo=>+1.01e1'::hstore;
259 SELECT 'foo=>+1.01e+1'::hstore;
265 SELECT 'foo=>+1.01e-1'::hstore;
271 SELECT 'foo=>+.1'::hstore;
277 SELECT 'foo=>+.1e'::hstore;
283 SELECT 'foo=>+.1e1'::hstore;
289 SELECT 'foo=>+.1e+1'::hstore;
295 SELECT 'foo=>+.1e-1'::hstore;
301 SELECT 'foo=>-1'::hstore;
307 SELECT 'foo=>-1.'::hstore;
313 SELECT 'foo=>-1.0'::hstore;
319 SELECT 'foo=>-1.01'::hstore;
325 SELECT 'foo=>-1.01e'::hstore;
331 SELECT 'foo=>-1.01e1'::hstore;
337 SELECT 'foo=>-1.01e+1'::hstore;
343 SELECT 'foo=>-1.01e-1'::hstore;
349 SELECT 'foo=>-.1'::hstore;
355 SELECT 'foo=>-.1e'::hstore;
361 SELECT 'foo=>-.1e1'::hstore;
367 SELECT 'foo=>-.1e+1'::hstore;
373 SELECT 'foo=>-.1e-1'::hstore;
379 SELECT 'foo=>1e2000'::hstore;
385 SELECT 'foo=>1e12, bar=>x'::hstore ^> 'foo';
391 SELECT 'foo=>1e12, bar=>x'::hstore ^> 'bar';
397 SELECT 'foo=>1e12, bar=>x'::hstore ^> 0;
403 SELECT 'foo=>1e12, bar=>x'::hstore ^> 1;
409 SELECT '[foo, 1e12, bar, x]'::hstore ^> 'foo';
415 SELECT '[foo, 1e12, bar, x]'::hstore ^> 'bar';
421 SELECT '[foo, 1e12, bar, x]'::hstore ^> 0;
427 SELECT '[foo, 1e12, bar, x]'::hstore ^> 1;
433 SELECT 'foo=>{x, 1e-12}'::hstore #^> '{foo, 0}';
439 SELECT 'foo=>{x, 1e-12}'::hstore #^> '{foo, 1}';
445 SELECT 'foo=>t, bar=>x'::hstore ?> 'foo';
451 SELECT 'foo=>t, bar=>x'::hstore ?> 'bar';
457 SELECT 'foo=>t, bar=>x'::hstore ?> 0;
463 SELECT 'foo=>t, bar=>x'::hstore ?> 1;
469 SELECT '[foo, t, bar, x]'::hstore ?> 'foo';
475 SELECT '[foo, t, bar, x]'::hstore ?> 'bar';
481 SELECT '[foo, t, bar, x]'::hstore ?> 0;
487 SELECT '[foo, t, bar, x]'::hstore ?> 1;
493 SELECT 'foo=>{x, t}'::hstore #?> '{foo, 0}';
499 SELECT 'foo=>{x, t}'::hstore #?> '{foo, 1}';
505 SELECT 'foo=>f, bar=>x'::hstore ?> 'foo';
511 SELECT 'foo=>f, bar=>x'::hstore ?> 'bar';
517 SELECT 'foo=>f, bar=>x'::hstore ?> 0;
523 SELECT 'foo=>f, bar=>x'::hstore ?> 1;
529 SELECT '[foo, f, bar, x]'::hstore ?> 'foo';
535 SELECT '[foo, f, bar, x]'::hstore ?> 'bar';
541 SELECT '[foo, f, bar, x]'::hstore ?> 0;
547 SELECT '[foo, f, bar, x]'::hstore ?> 1;
553 SELECT 'foo=>{x, f}'::hstore #?> '{foo, 0}';
559 SELECT 'foo=>{x, f}'::hstore #?> '{foo, 1}';
565 SELECT hstore_typeof('a=>b') AS hash;
571 SELECT hstore_typeof('{a=>b}') AS hash;
577 SELECT hstore_typeof('{a, b}') AS array;
583 SELECT hstore_typeof('{{a=>b}}') AS array;
589 SELECT hstore_typeof('[a, b]') AS array;
595 SELECT hstore_typeof('') AS "NULL";
601 SELECT hstore_typeof('NULL') AS "null";
607 SELECT hstore_typeof('1.0') AS numeric;
613 SELECT hstore_typeof('t') AS bool;
619 SELECT hstore_typeof('f') AS bool;
625 SELECT hstore('xxx', 't'::bool);
631 SELECT hstore('xxx', 'f'::bool);
637 SELECT hstore('xxx', 3.14);
643 SELECT hstore('xxx', 3.14::numeric);
649 SELECT hstore('xxx', '3.14'::numeric);
661 SELECT hstore('NULL');
667 SELECT hstore('t'::bool) AS "true", hstore('f'::bool) AS "false";
673 SELECT hstore(3.14), hstore(3.14::numeric), hstore('3.14'::numeric);
674 hstore | hstore | hstore
675 --------+--------+--------
679 SELECT hstore('xxx', 'foo=>t, bar=>3.14, zzz=>xxx'::hstore);
681 ----------------------------------------------
682 "xxx"=>{"bar"=>3.14, "foo"=>t, "zzz"=>"xxx"}
685 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::int2[]);
687 -------------------------
688 [[1, 1, 4], [23, 3, 5]]
691 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::int4[]);
693 -------------------------
694 [[1, 1, 4], [23, 3, 5]]
697 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::int8[]);
699 -------------------------
700 [[1, 1, 4], [23, 3, 5]]
703 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::float4[]);
705 -------------------------
706 [[1, 1, 4], [23, 3, 5]]
709 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::float8[]);
711 -------------------------
712 [[1, 1, 4], [23, 3, 5]]
715 SELECT array_to_hstore('{{1,1,f},{f,t,NULL}}'::bool[]);
717 ---------------------------
718 [[t, t, f], [f, t, NULL]]
721 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::text[]);
723 -------------------------------------
724 [["1", "1", "4"], ["23", "3", "5"]]
727 SELECT array_to_hstore('{{1,1,4},{23,3,5}}'::varchar[]);
729 -------------------------------------
730 [["1", "1", "4"], ["23", "3", "5"]]
733 SELECT array_to_hstore('{{{1,11},{1,1},{4,41}},{{23,231},{3,31},{5,51}}}'::int4[]);
735 -------------------------------------------------------------
736 [[[1, 11], [1, 1], [4, 41], [23, 231]], [[3, 31], [5, 51]]]
739 SELECT hstore('array', array_to_hstore('{{{1,11},{1,1},{4,41}},{{23,231},{3,31},{5,51}}}'::int4[]));
741 ----------------------------------------------------------------------
742 "array"=>[[[1, 11], [1, 1], [4, 41], [23, 231]], [[3, 31], [5, 51]]]
745 SELECT 'a=>"00012333", b=>"12233", c=>00012333, d=>12233'::hstore;
747 -------------------------------------------------------
748 "a"=>"00012333", "b"=>"12233", "c"=>12333, "d"=>12233
751 SELECT hstore_to_json('a=>"00012333", b=>"12233", c=>00012333, d=>12233'::hstore);
753 ---------------------------------------------------------
754 {"a": "00012333", "b": "12233", "c": 12333, "d": 12233}
757 SELECT hstore_to_json_loose('a=>"00012333", b=>"12233", c=>00012333, d=>12233'::hstore);
759 -------------------------------------------------------
760 {"a": "00012333", "b": 12233, "c": 12333, "d": 12233}