Re: jsonb crash
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: David Rowley <dgrowley@gmail.com>, David Rowley <drowley@postgresql.org>,
Jaime Casanova <jcasanov@systemguards.com.ec>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-09-29T22:54:52Z
Lists: pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes: > On Thu, 30 Sept 2021 at 11:20, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> 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. > I'm not really sure if I follow your comment about the top-level qual > operator. I'm not really sure why that has anything to do with it. > Remember that we *never* do any hashing of any values from the inner > side of the join. If we're doing a parameterized nested loop and say > our parameter has the value of 1, the first time through we don't find > any cached tuples, so we run the plan from the inner side of the > nested loop join and cache all the tuples that we get from it. When > the parameter changes, we check if the current value of the parameter > has any tuples cached. Right, and the point is that if you *do* get a hit, you are assuming that the inner side would return the same values as it returned for the previous hash-equal value. You are doing yourself no good by thinking about simple cases like integers. Think about float8, and ask yourself whether, if you cached a result for +0, that result is still good for -0. In general we can only assume that for applications of the hash equality operator itself (or members of its hash opfamily). Anything involving a cast to text, for example, would fail on such a case. > This allows us to memoize any join expression, not just equality > expressions. I am clearly failing to get through to you. Do I need to build an example? regards, tom lane
Commits
-
Allow Memoize to operate in binary comparison mode
- 6c32c0977783 14.2 landed
- e502150f7d0b 15.0 landed
-
Fix incorrect hash equality operator bug in Memoize
- 1f194ed6c26e 14.1 landed
- 39a3105678a2 15.0 landed