mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Add a 64-bit hash function for type hstore.
There's some question about the correctness of the hash function, but if it's wrong, the 32-bit version is also wrong. Amul Sul, reviewed by Hironobu Suzuki Discussion: https://postgr.es/m/CAAJ_b947JjnNr9Cp45iNjSqKf6PA5mCTmKsRwPjows93YwQrmw@mail.gmail.com
This commit is contained in:
@ -350,3 +350,12 @@ insert into test_json_agg values ('rec1','"a key" =>1, b => t, c => null, d=> 12
|
||||
('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;
|
||||
|
||||
-- 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);
|
||||
|
Reference in New Issue
Block a user