Re: jsonb crash - Mailing list pgsql-hackers

From Tom Lane
Subject Re: jsonb crash
Date
Msg-id 3005541.1632954056@sss.pgh.pa.us
Whole thread Raw
In response to Re: jsonb crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: jsonb crash
List pgsql-hackers
I wrote:
> 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.

Hmm ... I think that actually, a correct statement of the semantic
restriction is

    To be eligible for memoization, the inside of a join can use the
    passed-in parameters *only* as direct arguments of hashable equality
    operators.

In order to exploit RestrictInfo-based caching, you could make the
further restriction that all such equality operators appear at the
top level of RestrictInfo clauses.  But that's not semantically
necessary.

As an example, assuming p1 and p2 are the path parameters,

    (p1 = x) xor (p2 = y)

is semantically safe to memoize, despite the upper-level xor
operator.  But the example we started with, with a parameter
used as an argument of jsonb_exists, is not safe to memoize
because we have no grounds to suppose that two hash-equal values
will act the same in jsonb_exists.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michail Nikolaev
Date:
Subject: Re: [PATCH] Full support for index LP_DEAD hint bits on standby
Next
From: Peter Geoghegan
Date:
Subject: Re: Enabling deduplication with system catalog indexes