Re: Reproducible coliisions in jsonb_hash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Valeriy Meleshkin <valeriy(at)meleshk(dot)in>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reproducible coliisions in jsonb_hash
Date: 2022-05-12 13:57:24
Message-ID: 309877.1652363844@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> 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 unclear about the implications
> of fixing it.

Changing this hash algorithm would break existing hash indexes on jsonb
columns. Maybe there aren't any, but even if so I can't get very excited
about changing this. Hash algorithms always have collisions, and we have
never made any promise that ours are cryptographically strong.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-05-12 14:01:31 Re: First draft of the PG 15 release notes
Previous Message Bruce Momjian 2022-05-12 13:53:45 Re: First draft of the PG 15 release notes