-- Check whether any of our opclasses fail amvalidate SELECT amname, opcname FROM pg_opclass opc LEFTJOIN pg_am am ON am.oid = opcmethod WHERE opc.oid >= 16384ANDNOT amvalidate(opc.oid);
-- also try it with non-error-throwing API select pg_input_is_valid('a=>b', 'hstore'); select pg_input_is_valid('a=b', 'hstore'); select * from pg_input_error_info('a=b', 'hstore'); select * from pg_input_error_info(' =>b', 'hstore');
select count(*) from testhstore where h @> 'wait=>NULL'; select count(*) from testhstore where h @> 'wait=>CC'; select count(*) from testhstore where h @> 'wait=>CC, public=>t'; select count(*) from testhstore where h ? 'public'; select count(*) from testhstore where h ?| ARRAY['public','disabled']; select count(*) from testhstore where h ?& ARRAY['public','disabled'];
createindex hidx on testhstore using gist(h); set enable_seqscan=off;
select count(*) from testhstore where h @> 'wait=>NULL'; select count(*) from testhstore where h @> 'wait=>CC'; select count(*) from testhstore where h @> 'wait=>CC, public=>t'; select count(*) from testhstore where h ? 'public'; select count(*) from testhstore where h ?| ARRAY['public','disabled']; select count(*) from testhstore where h ?& ARRAY['public','disabled'];
dropindex hidx; createindex hidx on testhstore using gist(h gist_hstore_ops(siglen=0)); createindex hidx on testhstore using gist(h gist_hstore_ops(siglen=2025)); createindex hidx on testhstore using gist(h gist_hstore_ops(siglen=2024)); set enable_seqscan=off;
select count(*) from testhstore where h @> 'wait=>NULL'; select count(*) from testhstore where h @> 'wait=>CC'; select count(*) from testhstore where h @> 'wait=>CC, public=>t'; select count(*) from testhstore where h ? 'public'; select count(*) from testhstore where h ?| ARRAY['public','disabled']; select count(*) from testhstore where h ?& ARRAY['public','disabled'];
dropindex hidx; createindex hidx on testhstore using gin (h); set enable_seqscan=off;
select count(*) from testhstore where h @> 'wait=>NULL'; select count(*) from testhstore where h @> 'wait=>CC'; select count(*) from testhstore where h @> 'wait=>CC, public=>t'; select count(*) from testhstore where h ? 'public'; select count(*) from testhstore where h ?| ARRAY['public','disabled']; select count(*) from testhstore where h ?& ARRAY['public','disabled'];
select count(*) from (select (each(h)).keyfrom testhstore) as wow ; selectkey, count(*) from (select (each(h)).keyfrom testhstore) as wow groupbykeyorderby count desc, key;
-- sort/hash select count(distinct h) from testhstore; set enable_hashagg = false; select count(*) from (select h from (select * from testhstore unionallselect * from testhstore) hs groupby h) hs2; set enable_hashagg = true; set enable_sort = false; select count(*) from (select h from (select * from testhstore unionallselect * from testhstore) hs groupby h) hs2; selectdistinct * from (values (hstore '' || ''),('')) v(h); set enable_sort = true;
-- btree dropindex hidx; createindex hidx on testhstore using btree (h); set enable_seqscan=off;
select count(*) from testhstore where h #># 'p=>1'; select count(*) from testhstore where h = 'pos=>98, line=>371, node=>CBA, indexed=>t';
-- json and jsonb select hstore_to_json('"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'); select cast( hstore '"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'as json); select hstore_to_json_loose('"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4, h=> "2016-01-01"');
select hstore_to_jsonb('"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'); select cast( hstore '"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'as jsonb); select hstore_to_jsonb_loose('"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4, h=> "2016-01-01"');
createtable test_json_agg (f1 text, f2 hstore); insertinto test_json_agg values ('rec1','"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'),
('rec2','"a key" =>2, b => f, c => "null", d=> -12345, e => 012345.6, f=> -1.234, g=> 0.345e-4'); select json_agg(q) from test_json_agg q; select json_agg(q) from (select f1, hstore_to_json_loose(f2) as f2 from test_json_agg) q;
-- Test subscripting insertinto test_json_agg defaultvalues; select f2['d'], f2['x'] isnullas x_isnull from test_json_agg; select f2['d']['e'] from test_json_agg; -- error select f2['d':'e'] from test_json_agg; -- error update test_json_agg set f2['d'] = f2['e'], f2['x'] = 'xyzzy'; select f2 from test_json_agg;
-- Test subscripting in plpgsql
do $$ declare h hstore;
begin h['a'] := 'b'; raise notice 'h = %, h[a] = %', h, h['a']; end $$;
-- Check the hstore_hash() and hstore_hash_extended() function explicitly. SELECT v as value, hstore_hash(v)::bit(32) as standard,
hstore_hash_extended(v, 0)::bit(32) as extended0,
hstore_hash_extended(v, 1)::bit(32) as extended1 FROM (VALUES (NULL::hstore), (''), ('"a key" =>1'), ('c => null'),
('e => 012345'), ('g => 2.345e+4')) x(v) WHERE hstore_hash(v)::bit(32) != hstore_hash_extended(v, 0)::bit(32) OR hstore_hash(v)::bit(32) = hstore_hash_extended(v, 1)::bit(32);
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.