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 17:54:56 -0400
Message-ID: <3004308.1632952496@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHoyFK_g-Q7mC4BwzZJ+ZWjcV+35SN8_8iKLUgth7+aq9QcYTw@mail.gmail.com>
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>

David Rowley <dgrowley@gmail.com> writes:
> On Thu, 30 Sept 2021 at 10:20, Tom Lane <tgl@sss.pgh.pa.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





view thread (23+ messages)  latest in thread

Message-ID: <3004308.1632952496@sss.pgh.pa.us>
Permalink:  ../3004308.1632952496@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3004308.1632952496@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: <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>

* 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