Re: Clean up remove_rel_from_query() after self-join elimination commit

From: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Clean up remove_rel_from_query() after self-join elimination commit
Date: 2026-04-20 00:49:25
Message-ID: CAGjGUALwC9uRxqvmQSk9Cg5VR2qewTuKe+=seXmynPP4PwFsDQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Richard
> Assert(!is_outer_join || joinrelids != NULL);

> Worth asserting. If a caller sets sjinfo but passes NULL for
> joinrelids, this would silently over-delete PHVs.
> Assert(!is_self_join || joinrelids == NULL);

LGTM with the added assertion. Thanks again for all the heavy lifting
you're doing on the Postgres optimizer

> I prefer to not add this one. It's not defending any invariant.
Thank you for your explanation ,

Thanks

On Sat, Apr 18, 2026 at 6:17 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> On Tue, Apr 7, 2026 at 6:57 PM wenhui qiu <qiuwenhuifx(at)gmail(dot)com> wrote:
> > Assert(!is_outer_join || joinrelids != NULL);
>
> Worth asserting. If a caller sets sjinfo but passes NULL for
> joinrelids, this would silently over-delete PHVs.
>
> > Assert(!is_self_join || joinrelids == NULL);
>
> I prefer to not add this one. It's not defending any invariant.
>
> - Richard
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message SATYANARAYANA NARLAPURAM 2026-04-20 00:55:26 Re: [BUG] ON CONFLICT DO UPDATE SET x = EXCLUDED.<virtual-generated-column> errors or silently writes NULL
Previous Message SATYANARAYANA NARLAPURAM 2026-04-20 00:32:55 Re: [BUG]: WHERE CURRENT OF cursor fail on tables that have virtual generated columns