Re: Removing unneeded self joins - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Removing unneeded self joins
Date
Msg-id CAMbWs48cO0UUkMT6SbCVyXSx+GvNcjvkEJwt1iDNhT1D2kRPyA@mail.gmail.com
Whole thread Raw
In response to Re: Removing unneeded self joins  (Alexander Korotkov <aekorotkov@gmail.com>)
Responses Re: Removing unneeded self joins
List pgsql-hackers
On Fri, Apr 4, 2025 at 1:02 AM Alexander Korotkov <aekorotkov@gmail.com> wrote:
> I've got an off-list bug report from Alexander Lakhin involving a
> placeholder variable.  Alena and Andrei proposed a fix.  It is fairly
> simple: we just shouldn't remove PHVs during self-join elimination, as
> they might still be referenced from other parts of a query.  The patch
> is attached.  I'm going to fix this if no objections.

Hmm, I'm not sure about the fix.  It seems to me that it simply
prevents removing any PHVs in the self-join removal case.  My concern
is that this might result in PHVs that could actually be removed not
being removed in many cases.

Besides, there's the specific comment above this code explaining the
logic behind the removal of PHVs.  Shouldn't that comment be updated
to reflect the changes?

Thanks
Richard



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Statistics Import and Export
Next
From: Kyotaro Horiguchi
Date:
Subject: Quote-less file names in error messages