Re: [PG19] Wrong results from Memoize with a nondeterministic collation

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Shihao Zhong <zhong950419(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Guofeng Lin <guofenglinux(at)gmail(dot)com>
Subject: Re: [PG19] Wrong results from Memoize with a nondeterministic collation
Date: 2026-10-08 06:00:10
Message-ID: 179143921097.761822.15147859541810201857@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shihao,

> So it is an old bug with a new way in.

Confirmed, and the split is clean when measured on the current tip of
each branch: the LEFT JOIN wrong results are there from 14, while the
NOT EXISTS (anti join) case appears only from 19, where 0da29e4cb16
let anti joins use Memoize -- matching your "regression from 18".

0001 fixes it and make check passes on all of 14 through 19 and
master. I also checked it holds across several nondeterministic
collations, a two-column key, a varchar outer column, a non-Var outer
expression, a partitioned inner rel, and LEFT JOIN LATERAL (already
right, since lateral_vars go into binary mode).

One caveat for the back branches: on 14-16 the new block must go
before the lappend into *param_exprs -- there is no list_member test
there. patch/git apply with fuzz instead places it after, which
still compiles and passes make check but leaves the bug unfixed (I
measured that on 16). A mechanical back-patch would look fine and
fix nothing; I can post the by-hand hunks for 14-16 if that helps.

Manu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-10-08 06:00:16 Incorrect CONTEXT reported for errors from parallel apply worker in logical replication
Previous Message Masahiko Sawada 2026-10-08 05:49:02 Re: Parallel autovacuum: DROP DATABASE WITH (FORCE) fails on the parallel workers