The bogus calls in remove_self_join_rel() - Mailing list pgsql-hackers

From Richard Guo
Subject The bogus calls in remove_self_join_rel()
Date
Msg-id CAMbWs49fYQcqJfJ_Gtn8r1GFNoYtb1=2AUab4ieuqY4Zid9ocQ@mail.gmail.com
Whole thread
Responses Re: The bogus calls in remove_self_join_rel()
Re: The bogus calls in remove_self_join_rel()
List pgsql-hackers
I noticed these two calls in remove_self_join_rel():

    adjust_relid_set(root->all_result_relids, toRemove->relid, toKeep->relid);
    adjust_relid_set(root->leaf_result_relids, toRemove->relid, toKeep->relid);

There's no comment explaining them, and as far as I can tell they do
nothing: adjust_relid_set returns a Relids and does not modify the
input in place.

Rather than make the calls do the cleanup they pretend to do, I think
a better way is to replace them with assertions: toRemove->relid is
not a member of either set.  This is true as these two sets contain
only parse->resultRelation (rejected as an SJE candidate to preserve
EvalPlanQual) and inheritance children of the target, which never
appear in the joinlist that SJE scans for candidates.

Thoughts?

- Richard

Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Parallel Apply
Next
From: jian he
Date:
Subject: Re: [PATCH] Fix duplicate errmsg in ALTER TABLE SPLIT PARTITION