Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wEq2B-004T1s-05 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 14:55:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEq2A-003Ubk-10 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 14:55:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wEq29-003Ubb-1t for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 14:55:34 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wEq27-00000001wI2-1WUO for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 14:55:32 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 5A7631D001C0; Mon, 20 Apr 2026 10:55:30 -0400 (EDT) Received: from phl-imap-14 ([10.202.2.87]) by phl-compute-02.internal (MEProxy); Mon, 20 Apr 2026 10:55:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1776696930; x=1776783330; bh=Tw+riKm0MBIN3mIYdSJMW/gopDONzOH3wHMyFvj9mWg=; b= sEsgkjxUmiwZ8xXVdvKJO2P3BnRUKpEMbwzh6hfNlkPpNnwsMo+aXjOtW0KXlBHm yOX0Yitci9sul0pB0Y9jvCmSuznQRj+y/92vVWVuwzzL6GFlAFEE8E3htfUqyFxW dDijF4jPzI8rMdR+Wommxl2zhGLGQ1yG6VVm01USPfHjXsScTQlLK/q8J1daB5fy X6h8J+zMy3HP9HsNZCryOkFa45URR11Vf1Ied8lU0UJkPYvNbiC1LpxcAR6xuPlW reD/Mceb8/kpLiRcoLsQWFKx6Q8DQt2Uq54hWB2H9aBPZJHhAPEw46BqaeF+JJSy +dAb7Wr52b21ATRQi7MUsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1776696930; x= 1776783330; bh=Tw+riKm0MBIN3mIYdSJMW/gopDONzOH3wHMyFvj9mWg=; b=O nW59EQgJX60stDzavPcAPMw1MQXOUjTUh0H/QeErl00I80UV1217/CH0xboBmFDU KMszEevoMB4OtptYj5xUPXpJ9pyZKUyFJQQghSbI2JrjjF2WnGluO6tbyOC7z7Jw 4uozo6zNqLhRHsYsFonKbvbFhSoWwRUi8uvyIKtY3napDt10UAuWvoVIMhcguKo9 fgan2/2o5d859+qbabquhkFuQzAragKDu7otcBOeBN2+ZK7VrESz4JWVnHbKzOR+ BqYYbTDjezbH/lHvXERUWfXDXEGLNJ2PCYnEWsx3Z+AZWoNBIEe+qeSXMebCyXIA GD5Lmq0Jqd0aW/wwG0ItA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdehkeekudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfirhgvghcu uehurhgufdcuoehgrhgvghessghurhgurdhmvgeqnecuggftrfgrthhtvghrnhepvdeuhf fftddvveeuffetheehfeelveetvdeftdeufeffieejfeduleevfedtffdunecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsegsuhhrug drmhgvpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthho pegughhrohiflhgvhihmlhesghhmrghilhdrtghomhdprhgtphhtthhopehlihdrvghvrg hnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgv rhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehtghhlse hsshhsrdhpghhhrdhprgdruhhs X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id E071BC4006E; Mon, 20 Apr 2026 10:55:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AL8iTvk4FHio Date: Mon, 20 Apr 2026 10:55:09 -0400 From: "Greg Burd" To: "David Rowley" Cc: "Tom Lane" , "Chao Li" , "PostgreSQL Hackers" Message-Id: <6cb75f47-261b-4476-b8e8-18fa6aad464f@app.fastmail.com> In-Reply-To: References: <278B9FE3-F349-4494-99C5-483105C1C999@gmail.com> <1900289.1776212948@sss.pgh.pa.us> <1913188.1776220247@sss.pgh.pa.us> <77f5109f-6d39-4cf1-8d0d-f826435d6cb6@app.fastmail.com> Subject: Re: Add bms_offset_members() function for bitshifting Bitmapsets Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Apr 19, 2026, at 7:52 PM, David Rowley wrote: > On Mon, 20 Apr 2026 at 07:22, Greg Burd 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