Re: Fixing a few minor misusages of bms_union()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Burd <greg@burd.me>
Cc: David Rowley <dgrowleyml@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-03T15:30:36Z
Lists: pgsql-hackers
Greg Burd <greg@burd.me> writes:
> On Oct 3 2025, at 10:04 am, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> This change in substitute_phv_relids_walker is *not* safe according
>> to the routine's head comment:

> I'll have to remember to scroll up a bit more when reviewing and always
> read the header comments.  I missed that one entirely, apologies. When I
> read the bitmapset_del() below the bitmapset_union() I incorrectly
> assumed that it was okay to modify it in-place.  Maybe a short comment
> above that line would be useful?

After we've done the union(), we know we have a singly-referenced
bitmapset, so it's safe for the second change to be in-place.

			regards, tom lane



Commits

  1. Use bms_add_members() instead of bms_union() when possible