pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowley@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: David Rowley <drowley@postgresql.org>
Cc: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: jsonb crash
Date: Wed, 29 Sep 2021 18:20:56 -0400
Message-ID: <3005541.1632954056@sss.pgh.pa.us> (raw)
In-Reply-To: <3004308.1632952496@sss.pgh.pa.us>
References: <20210929185544.GB24346@ahch-to>
	<2998377.1632945612@sss.pgh.pa.us>
	<2999546.1632947043@sss.pgh.pa.us>
	<CAApHDvo6XS8Gxs1JMROPdAX8MTe=FWCesH5Y+jzGZD3ADawsnQ@mail.gmail.com>
	<3001998.1632949788@sss.pgh.pa.us>
	<CAApHDvozNHQfqUCfcZ2+J4jJWXHG8AHUU+VD94-ZLda25fWFxA@mail.gmail.com>
	<3002519.1632950409@sss.pgh.pa.us>
	<CAHoyFK_g-Q7mC4BwzZJ+ZWjcV+35SN8_8iKLUgth7+aq9QcYTw@mail.gmail.com>
	<3004308.1632952496@sss.pgh.pa.us>

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





view thread (23+ messages)  latest in thread

Message-ID: <3005541.1632954056@sss.pgh.pa.us>
Permalink:  ../3005541.1632954056@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3005541.1632954056@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowley@gmail.com, dgrowleyml@gmail.com, drowley@postgresql.org, jcasanov@systemguards.com.ec
  Subject: Re: jsonb crash
  In-Reply-To: <3005541.1632954056@sss.pgh.pa.us>
  References: <20210929185544.GB24346@ahch-to> <2998377.1632945612@sss.pgh.pa.us> <2999546.1632947043@sss.pgh.pa.us> <CAApHDvo6XS8Gxs1JMROPdAX8MTe=FWCesH5Y+jzGZD3ADawsnQ@mail.gmail.com> <3001998.1632949788@sss.pgh.pa.us> <CAApHDvozNHQfqUCfcZ2+J4jJWXHG8AHUU+VD94-ZLda25fWFxA@mail.gmail.com> <3002519.1632950409@sss.pgh.pa.us> <CAHoyFK_g-Q7mC4BwzZJ+ZWjcV+35SN8_8iKLUgth7+aq9QcYTw@mail.gmail.com> <3004308.1632952496@sss.pgh.pa.us> <3005541.1632954056@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox