Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error
Maksim Milyutin <maksim.milyutin@tantorlabs.ru>
From: Maksim Milyutin <maksim.milyutin@tantorlabs.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>, Richard Guo <guofenglinux@gmail.com>
Cc: Sergey Soloviev <sergey.soloviev@tantorlabs.ru>,
pgsql-hackers@lists.postgresql.org
Date: 2025-08-26T20:04:20Z
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
On 8/26/25 20:26, Tom Lane wrote: > Richard Guo <guofenglinux@gmail.com> writes: > >> We could then use this function to remove expressions that are known >> constant from semi_rhs_exprs. And if we find that all expressions >> in semi_rhs_exprs are known constant (the second loose end you >> mentioned), we can give up building unique paths and fall back to a >> traditional JOIN_SEMI. > Yeah, I was thinking we could just use the paths of the existing > rel, but really this case means that we'd need to de-dup down > to a single row. We could maybe do something involving plastering > LIMIT 1 on top of each input path Unique node over incoming empty rows seems to act as LIMIT 1, in particular, it breaks subplan execution after extracting the first row. Then I see v3 patch covers this case perfectly. -- Best regard, Maksim Milyutin