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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Sergey Soloviev <sergey(dot)soloviev(at)tantorlabs(dot)ru>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, 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-28 00:15:35
Message-ID: 1484250.1756340135@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> This leaves us with some pretty unappetizing choices about what
> to do in v18:
> 1. Try to emulate the proposed HEAD fix.

Actually, a preliminary look suggests that we can approximate
that quite well, because v18's create_unique_path() is already
responsible for preparing the list of columns to be de-duplicated
by a UniquePath. So we can stick the same logic about whether
make_pathkeys_for_sortclauses believes that each column adds something
into create_unique_path(). Unlike the case with HEAD, that doesn't
overlap with any useful work the function was already doing, but
I still think that the cost will be negligible in normal cases.

I'll try to have a patch along those lines by tomorrow.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-08-28 00:26:17 Re: Report reorder buffer size
Previous Message Thomas Munro 2025-08-28 00:08:17 Re: Non-reproducible AIO failure