public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tender Wang <[email protected]>
To: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Discarded adjust_relid_set() return values in remove_self_join_rel
Date: Sat, 25 Apr 2026 15:53:31 +0800
Message-ID: <CAHewXNnFeWk6oLm39rCS4YvZg8x_hFOzz1XDDXXK+VB6Up0Qtw@mail.gmail.com> (raw)
In-Reply-To: <CAHg+QDf+fJsyT_Oj6xDCGkyKWMQ=oEjLdxZ_K4WmKApQWP8hjA@mail.gmail.com>
References: <CAHg+QDf+fJsyT_Oj6xDCGkyKWMQ=oEjLdxZ_K4WmKApQWP8hjA@mail.gmail.com>

Hi,

SATYANARAYANA NARLAPURAM <[email protected]> 于2026年4月25日周六 15:44写道:
>
> 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.

The topic in [1] seems to be the same issue as your report.
You can take a look at [1] to double-check.

[1] https://www.postgresql.org/message-id/CAMbWs49fYQcqJfJ_Gtn8r1GFNoYtb1%3D2AUab4ieuqY4Zid9ocQ%40mail.g...
(Sorry for not adding pgsql-hackers mail  in the last email)


-- 
Thanks,
Tender Wang





view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Discarded adjust_relid_set() return values in remove_self_join_rel
  In-Reply-To: <CAHewXNnFeWk6oLm39rCS4YvZg8x_hFOzz1XDDXXK+VB6Up0Qtw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox