Re: Clean up remove_rel_from_query() after self-join elimination commit - Mailing list pgsql-hackers

From wenhui qiu
Subject Re: Clean up remove_rel_from_query() after self-join elimination commit
Date
Msg-id CAGjGUALwC9uRxqvmQSk9Cg5VR2qewTuKe+=seXmynPP4PwFsDQ@mail.gmail.com
Whole thread
In response to Re: Clean up remove_rel_from_query() after self-join elimination commit  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Clean up remove_rel_from_query() after self-join elimination commit
List 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@gmail.com> wrote:
On Tue, Apr 7, 2026 at 6:57 PM wenhui qiu <qiuwenhuifx@gmail.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

pgsql-hackers by date:

Previous
From: SATYANARAYANA NARLAPURAM
Date:
Subject: Re: [BUG]: WHERE CURRENT OF cursor fail on tables that have virtual generated columns
Next
From: SATYANARAYANA NARLAPURAM
Date:
Subject: Re: [BUG] ON CONFLICT DO UPDATE SET x = EXCLUDED. errors or silently writes NULL