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 1wyO7k-003M0Q-0f for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Aug 2026 06:25:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wyO7i-000uoI-33 for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Aug 2026 06:25: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 1wyO7i-000uo9-00 for pgsql-hackers@lists.postgresql.org; Mon, 24 Aug 2026 06:25:34 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wyO7f-000000028fl-2PKs for pgsql-hackers@lists.postgresql.org; Mon, 24 Aug 2026 06:25:33 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 1F06CEC0087; Mon, 24 Aug 2026 02:25:30 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-02.internal (MEProxy); Mon, 24 Aug 2026 02:25: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=fm3; t=1787552730; x=1787639130; bh=aiHIzrVMewLRCHngwHqQ/tngtGP8U2IlLbFCnwCQkw4=; b= VbX9Q3KPtCOg/1v5E6CASNkNpaKoxErmS+wa04xQnuTLxGKdvVuBquJ9jQSJftSj yJLHSp2T84lqwrWofl6iHmuLg5jy1AaOM2f/3jKsxEBNlpO7cAAfQ6b/pAEmWkHC BHa5iPS6YFgP1F5cbd2GvkmRj/XHtZuyR22CBPLH4DvXCvoFL95FqB3letLdyu4K gjbp5v619mDzsdiewGcaWMeyNVP5t7exTfq8o7bqidAKQOtPI/zVr9+cSlzzQrUz OQQBnHiNTPe5azn+kiLg4R4cTBWMCEj/xkob9TJzrKHx7UaxpqLVsdsRPybkccQQ 2UJ2i1voc57mqb31UwF6IA== 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=fm3; t=1787552730; x= 1787639130; bh=aiHIzrVMewLRCHngwHqQ/tngtGP8U2IlLbFCnwCQkw4=; b=Y LG+gbVyKls/3oJVvZYhhqaeZqS7gYm2xqJA0AV5cXfKn9i6rN6VNs9vB3QQmVS1O F1KWIH9XepZv7vbtXDwpCodRNCbWEuQy3bhzHChEZWH46bYs5JNOvbCCUCdHEQZU g+Xv7IoPbcaXXOhAnuNZ2Vq4Aof+RJhN2K7eRlTTJztIVkxPXo57FrYroR5YtBMy jeSe+SVSAyiGm09Yi2VSlR8v2GMw3zdGrR8xDIcp3HpKyDdkKps4iP3KBJsCGMsT 7KKO1wqCR9YrCluptfau2kXTDFZuwQ0qK4mUY7smahUkruWCjDrw2aSKkOaUPM6h r6B6fzqDJuiuEEioGuzRg== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTF0iXoTNOv0AJbyWwQtWRaFinIUuo6L5WLtmlWFLlt0+iqECHDm90wXJz4WdXsDAz VR3Z0lzL9qp+NnSgaNLJbDVFhwrblwDiwfXnBvYHzZ6NbMh7fTzA4fXceU7VTVrVxHpujV iVAEXkd+qwWnkeYL0LgH/eUPp00EdI0k0lSrTyDBAAADX4v8qSmGQLrrlC8/iWzUJknnMN Z6L2B2+KuKB+fPQMtDCIL11KFaRDg80UsvkoMAUF2qFAOWVl7GUd/iMR+V9GJhlhjWLUAd wDKdRLhPflUB85t0aRAb+SoyFA5ureryWz4bhPssOcJO2vs8UfZdoSrFvpr5RBUMA2p1mo 1e0dz0LN/PWYqkpdqV5PNfs7Ros+B7H+8jgjTe4F4BNRhvpL69xr/WYdh3+gZtW01eiAQD aX+s4Wt/gEKELHfNnudhXzOc8Uvt0OkL4/kfLRIBoCRE9B9WbQG/V3hA3sCZgbSk0bfyIc VDDgZIegdjYYIkkB14ybjbyeWN9PzRtW7eXjJrlNGDwN23RxTOepb2nT08M0MbqAjZt2qT 07tzJ+mu/w03AioxHXVAcpwXLDwiWEW6rNQ6Qdd48ANGROUH3R427qraT8P4V6Iu2kT/6P 5UMfPPsxsV+Eq/D2/y4nGSAn1zQbLJzAT8EzrUR3RCIWB0Ma9feE/MRijotA X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A3F6D700065; Mon, 24 Aug 2026 02:25:28 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AL8iTvk4FHio Date: Mon, 24 Aug 2026 02:25:08 -0400 From: "Greg Burd" To: "David Rowley" , "Peter Eisentraut" Cc: "Tom Lane" , "Chao Li" , "PostgreSQL Hackers" Message-Id: <66d041b4-32f4-4097-bb2c-0e7147337a5e@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> <08fa9f01-373e-4cb4-9650-ad20517e2de3@eisentraut.org> 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 Sat, Aug 22, 2026, at 9:38 PM, David Rowley wrote: > On Thu, 9 Jul 2026 at 11:55, David Rowley wrote: >> I pushed a change to make seed int64 instead. It's still possible to >> specify the full range of possible values that GetCurrentTimestamp() >> can (or could ever) return with the int64 type. This way, there's no >> longer a mismatch in the format specifier for elog and the type we're >> formatting. That's an improvement, so thanks. Hey David, > I was just in this area again and noticed that the nmembers > calculation does not take into account the min_value parameter. The > bad code is: > > nmembers = pg_prng_uint32(&state) % max_range + min_value; Indeed, good catch. > That should really be subtracting the min_value, as I had intended > nmembers to do was populate a random set of members in the range > specified by the function. While there, I noticed that the parameter > names are not very consistently named and having the max_value before > the min_value seems weird too. I agree that is an implicit convention and is more intuitive. > I understand test_random_operations() > has it that way. I didn't adjust that function. Maybe that could be > done separately since it's also in v19, whereas > test_random_offset_operations() is new to v20. I think this is a good idea, simply to be consistent/tidy and re-enforce the pattern for future work. > I've attached a patch which fixes this plus a few more things that > Claude code pointed out to me when I asked it to review my changes. > Those are primarily around overflow risk if max_value was given as > INT32_MAX. I applied, reviewed, and tested the v1 patch. I think it is good and necessary for the reasons you've outlined. I'd happily help or implement the additional test_random_operations() for v20/v19 when I get a second (currently traveling) if you're not going to do so. Thanks for continuing to improve this testing module. best. -greg > David > > Attachments: > * v1-0001-Fix-incorrect-nmembers-calculation-in-test_bitmap.patch