Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error

From: Maksim Milyutin <maksim(dot)milyutin(at)tantorlabs(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Sergey Soloviev <sergey(dot)soloviev(at)tantorlabs(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error
Date: 2025-08-26 20:04:20
Message-ID: a2013df4-207a-423f-9127-f8861fbce5f7@tantorlabs.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/26/25 20:26, Tom Lane wrote:

> Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-08-26 20:10:43 Re: pgsql: oauth: Add unit tests for multiplexer handling
Previous Message Kirill Reshke 2025-08-26 20:01:24 Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)