Re: jsonb crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowley(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, David Rowley <drowley(at)postgresql(dot)org>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb crash
Date: 2021-09-29 21:54:56
Message-ID: 3004308.1632952496@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Rowley <dgrowley(at)gmail(dot)com> writes:
> On Thu, 30 Sept 2021 at 10:20, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I'm still confused. AFAICS, the top-level operator of the qual clause has
>> exactly nada to do with the cache keys, as this example makes plain.

> You're right that it does not. The lateral join condition could be
> anything.

Actually, the more I look at this the more unhappy I get, because
it's becoming clear that you have made unfounded semantic
assumptions. The hash functions generally only promise that they
will distinguish values that are distinguishable by the associated
equality operator. We have plenty of data types in which that does
not map to bitwise equality ... you need not look further than
float8 for an example. And in turn, that means that there are lots
of functions/operators that *can* distinguish hash-equal values.
The fact that you're willing to treat this example as cacheable
means that memoize will fail on such clauses.

So I'm now thinking you weren't that far wrong to be looking at
hashability of the top-level qual operator. What is missing is
that you have to restrict candidate cache keys to be the *direct*
arguments of such an operator. Looking any further down in the
expression introduces untenable assumptions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2021-09-29 22:09:23 Re: [PATCH] Full support for index LP_DEAD hint bits on standby
Previous Message David Rowley 2021-09-29 21:43:54 Re: jsonb crash