Discarded adjust_relid_set() return values in remove_self_join_rel - Mailing list pgsql-hackers

From SATYANARAYANA NARLAPURAM
Subject Discarded adjust_relid_set() return values in remove_self_join_rel
Date
Msg-id CAHg+QDf+fJsyT_Oj6xDCGkyKWMQ=oEjLdxZ_K4WmKApQWP8hjA@mail.gmail.com
Whole thread
Responses Re: Discarded adjust_relid_set() return values in remove_self_join_rel
List pgsql-hackers
Hi hackers,

I found that remove_self_join_rel() in analyzejoins.c discards the
return values of two adjust_relid_set() calls when updating
root->all_result_relids and root->leaf_result_relids:

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

adjust_relid_set() does not modify its input in-place.  When it finds
the old relid in the set, it calls bms_copy() to create a new
Bitmapset, performs the substitution on the copy, and returns the new
pointer.  Without capturing the return value, the original sets are
never updated. Every other call site in the file  analyzejoins.c correctly
assigns the return value.

I am not able to craft a query to show it as a problem.
For the current release, these two lines appears to be a no-op?

Attached a patch to assign the returned values.

Thanks,
Satya
Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: small cleanup patches for collation code
Next
From: Tender Wang
Date:
Subject: Re: Discarded adjust_relid_set() return values in remove_self_join_rel