Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Sergey Soloviev <sergey.soloviev@tantorlabs.ru>,
Alexander Korotkov <aekorotkov@gmail.com>,
pgsql-hackers@lists.postgresql.org
Date: 2025-08-27T21:42:24Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix semijoin unique-ification for child relations
- 58ea074f1433 18.0 landed
- 97b0f36bde9a 19 (unreleased) landed
-
Fix "variable not found in subplan target lists" in semijoin de-duplication.
- b8a1bdc458e3 19 (unreleased) landed
- 3aee6283709f 18.0 landed
-
Recalculate where-needed data accurately after a join removal.
- a3179ab692be 18.0 cited
Attachments
- revert-a3179ab69-doesnt-work.patch (text/x-diff) patch
Richard Guo <guofenglinux@gmail.com> writes: > On Wed, Aug 27, 2025 at 2:26 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> I wonder if the right answer in v18 is to back out a3179ab69. >> Not fixing that performance regression for another year would >> be mildly annoying; but AFAIR we've still had only the one >> complaint, so it seems like it's not hurting many people. >> And we are getting mighty late in the release calendar to be >> inventing new stuff in v18. > Yeah, inventing new stuff in v18 at this point seems risky. I think > backing out a3179ab69 should be fine for v18. I had a go at doing that (attached) and the news is not good: it dumps core in some regression tests added by the SJE patch, seemingly because there are still references to the removed relid. Now it might be that I failed to correctly adjust the places where the revert didn't apply because of SJE-related changes. But I think what is more likely is that the SJE code is not bothering to update relids everywhere because it's expecting a3179ab69's "rebuild" logic to take care of things later. This leaves us with some pretty unappetizing choices about what to do in v18: 1. Try to emulate the proposed HEAD fix. 2. Try to fix up the SJE patch so that it calculates relid changes honestly, or at least no less honestly than what happened before a3179ab69. 3. Revert SJE as well as a3179ab69 in v18. I will have a look at #1. If there's somebody who wants to look at #2, feel free, but it won't be me because I don't understand the SJE patch well enough. Either way, it's not great to be doing stuff like this just days before rc1 ... regards, tom lane