Re: Add bms_offset_members() function for bitshifting Bitmapsets

From: "Greg Burd" <greg(at)burd(dot)me>
To: "David Rowley" <dgrowleyml(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add bms_offset_members() function for bitshifting Bitmapsets
Date: 2026-04-20 14:55:09
Message-ID: 6cb75f47-261b-4476-b8e8-18fa6aad464f@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sun, Apr 19, 2026, at 7:52 PM, David Rowley wrote:
> On Mon, 20 Apr 2026 at 07:22, Greg Burd <greg(at)burd(dot)me> wrote:
>> I applied, tested, and reviewed these changes. Thanks for doing this, only a few small things jumped out.
>
> Many thanks. I took all of those suggestions.

Happy to help.

>> SELECT test_bms_offset_members('(b 1)', -2147483648);
>
> I made that one use member 0 instead of 1. That'll mean "new_highest"
> goes to INT_MIN rather than INT_MIN + 1.

Perfect, that covers the gap nicely.

Were you planning on writing the optimized non-copy version as well? I don't think it is strictly necessary, more a curiosity.

bms_offset_members() -> new bms, might repalloc() replaces existing loops you've found
bms_shift_members() -> bms is modified in place and fits your new use case a bit better

best.

-greg

> David
>
> Attachments:
> * v3-0001-Introduce-bms_offset_members-function.patch

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayush Tiwari 2026-04-20 15:01:44 Re: [PATCH] Reject ENCODING option for COPY TO FORMAT JSON
Previous Message Antonin Houska 2026-04-20 14:52:15 Re: repack: fix a bug to reject deferrable primary key fallback for concurrent mode