Re: Reproducible coliisions in jsonb_hash

2022-05-15 Thread Stephen Frost
Greetings, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Robert Haas writes: > > Here, that doesn't seem too likely. You could have a column that > > contains 'tom' and ['tom'] and [['tom']] and [[['tom']]] and so forth > > and they all get mapped onto the same bucket and you're sad. But > > probably

Re: Reproducible coliisions in jsonb_hash

2022-05-12 Thread Tom Lane
Robert Haas writes: > Here, that doesn't seem too likely. You could have a column that > contains 'tom' and ['tom'] and [['tom']] and [[['tom']]] and so forth > and they all get mapped onto the same bucket and you're sad. But > probably not. Yeah, that might be a more useful way to think about it

Re: Reproducible coliisions in jsonb_hash

2022-05-12 Thread Robert Haas
On Thu, May 12, 2022 at 9:57 AM Tom Lane wrote: > Andrew Dunstan writes: > > On 2022-05-12 Th 07:02, Valeriy Meleshkin wrote: > >> AFAICT it happens because when iterating over a jsonb the hash function > >> makes no distinction between raw scalars and arrays (it doesn't inspect > >> v.val.arra

Re: Reproducible coliisions in jsonb_hash

2022-05-12 Thread Tom Lane
Andrew Dunstan writes: > On 2022-05-12 Th 07:02, Valeriy Meleshkin wrote: >> AFAICT it happens because when iterating over a jsonb the hash function >> makes no distinction between raw scalars and arrays (it doesn't inspect >> v.val.array.rawScalar) > It does look rather like a bug, but I'm unc

Re: Reproducible coliisions in jsonb_hash

2022-05-12 Thread Andrew Dunstan
On 2022-05-12 Th 07:02, Valeriy Meleshkin wrote: > Hello, > > I've noticed that > > jsonb_hash_extended(jsonb_v,0) = > jsonb_hash_extended(jsonb_build_array(jsonb_v),0) > > for any jsonb value jsonb_v. > > AFAICT it happens because when iterating over a jsonb the hash function makes > no dist

Reproducible coliisions in jsonb_hash

2022-05-12 Thread Valeriy Meleshkin
Hello, I've noticed that jsonb_hash_extended(jsonb_v,0) = jsonb_hash_extended(jsonb_build_array(jsonb_v),0) for any jsonb value jsonb_v. AFAICT it happens because when iterating over a jsonb the hash function makes no distinction between raw scalars and arrays (it doesn't inspect v.val.arr