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.94.2) (envelope-from ) id 1v6ZD3-006aI4-44 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 18:48:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v6ZCz-00CKaM-L8 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 18:48:18 +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.94.2) (envelope-from ) id 1v6ZCy-00CKa9-PO for pgsql-hackers@lists.postgresql.org; Wed, 08 Oct 2025 18:48:18 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v6ZCw-000iR5-22 for pgsql-hackers@lists.postgresql.org; Wed, 08 Oct 2025 18:48:16 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2397B1400094; Wed, 8 Oct 2025 14:48:15 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 08 Oct 2025 14:48:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :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=1759949295; x=1760035695; bh=uPyDZdUAuG ylveA/E4MunRAijCoKcDoUHmlhGbEPAZ8=; b=qazlM9EoIeTuig0eSOiGHGpKx0 3lCSXluv61BDodPgekjrJRdXW3gYAtIGOx9m1GQzpEw+Ut7prZT357deGVA4hQlN ZBLnw9DsZbaiLW4nqmwh+6UNk2ttSJwe8HVmeR8XjQyCZq/84IZYoQDqsgQGiBMn skF3/dZtbe6sEln0wfjzZ9g6cxtSvD05WKLSbjo8SopwdVhdkLZyrK7vd8hz5fW2 1HoOWhCGUsRT6WrwHtE5JO1xB3FPPOL4Cdj27KzPfE2UDTSny1ZTs2NtGQKu038w eHwF6Qr0uSKsj64yDd+YuI3Y86MTFyIA64gNqGGgrj8H+ukpCBlVqn5cL+sg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1759949295; x=1760035695; bh=uPyDZdUAuGylveA/E4MunRAijCoKcDoUHml hGbEPAZ8=; b=dDGcX3yqZYQkOvFcDvILJN2d5rgnh73Qij3LBIpT7sqY12sDav9 gRtoTOMmxZ/GWschhwkQgGwqbLghl9y0meQ6PkR/hWy0Hp1ROiYKUH3E/QQT8wez v+jYEXhgIWCGtDxZrXAIamxN5EdveL1JD4KjyJwYXTQIP74dR9MqYJW+lxcnSCyH VWoO6GkLN7Cwb2XPoDBwRSYeb83VLCp3UUmeEhpJs6W7ij7Pa5VnpYIfm6oA2jMG q1NbGB9EukgVamEpNKAZ/351IzFhpAAzjPg8+mfyIKMPaWA+s6wLLuV7oMoHoSpp U6MNqxNMbwgmYuUjU/TMysV9zCG0W6KXPrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdegtdeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevkfgjfhfuofggtgesmhdtmherredtjeenucfhrhhomhepifhrvghguceu uhhrugcuoehgrhgvghessghurhgurdhmvgeqnecuggftrfgrthhtvghrnhepfedvhfdule duveevgeehuefhtdeuvdeuieevgeeijeekgffgvefhkeekhfdtkeehnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsegsuhhrugdrmh gvpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehr rghnihgvrhdrvhhfsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggrnhhivghlseihvg hsqhhlrdhsvgdprhgtphhtthhopegughhrohiflhgvhihmlhesghhmrghilhdrtghomhdp rhgtphhtthhopehmihgthhgrvghlsehprghquhhivghrrdighiiipdhrtghpthhtohepph hgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Oct 2025 14:48:14 -0400 (EDT) Date: Wed, 8 Oct 2025 14:48:03 -0400 From: Greg Burd To: Ranier Vilela Cc: Daniel Gustafsson , David Rowley , Michael Paquier , PostgreSQL Hackers Message-ID: <2D90FFB0-C80A-4189-A5BF-C37F05E271D7@greg.burd.me> In-Reply-To: References: Subject: Re: [PATCH] Add tests for Bitmapset X-Mailer: Mailspring MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="68e6b1e3_6bd364f1_41f9" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --68e6b1e3_6bd364f1_41f9 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Oct 8 2025, at 8:10 am, Ranier Vilela wrote: > Hi. > =20 > =20 >> Em sex., 3 de out. de 2025 =C3=A0s 09:13, Greg Burd e= screveu: >> =20 >>> =20 >>> On Oct 3 2025, at 4:25 am, Daniel Gustafsson wrot= e: >>> =20 >>>>> On 3 Oct 2025, at 01:36, David Rowley wrot= e: >>>>> =20 >>>>> On =46ri, 3 Oct 2025 at 01:33, Daniel Gustafsson wrote: >>>>>> Another nitpick would be to remove the test for NULL in test=5Fbms= =5Fmake=5Fsingleton >>>>>> since that is a STRICT function, making the test for NULL >>>>>> superfluous code: >>>>> =20 >>>>> I see test=5Frandom=5Foperations() is also strict. Is it worth gett= ing rid >>>>> of the SQL NULL checks on the inputs there too=3F Aka, the attached= . >>>> =20 >>>> Indeed, but reading the code I wonder if STRICT was a mistake and >>>> the intention >>>> was to allow NULL input=3F >>> =20 >>> Yes, it was an oversight after I re-worked the random function. >>> =20 >>>> That being said, the function is never called with >>>> NULL so that's mostly academic thinking.=C2=A0 +1 for removing the N= ULL >>>> checks and simplifying the code. >>> =20 >>> I agree, and thank you both for the attention to detail and interest = in >>> this test suite. >> With the patch attached, there are regression. >> Is it intentional not to check the return of the function bms=5Fis=5Fm= ember=3F >> =20 >> diff --strip-trailing-cr -U3 >> C:/dll/postgres=5Fdev/postgres=5Fcommit/src/test/modules/test=5Fbitmap= set/expected/test=5Fbitmapset.out C:/dll/postgres=5Fdev/postgres=5Fcommit= /build/testrun/test=5Fbitmapset/regress/results/test=5Fbitmapset.out >> --- >> C:/dll/postgres=5Fdev/postgres=5Fcommit/src/test/modules/test=5Fbitmap= set/expected/test=5Fbitmapset.out >> 2025-10-02 21:17:53.169515700 -0300 >> +++ >> C:/dll/postgres=5Fdev/postgres=5Fcommit/build/testrun/test=5Fbitmapset= /regress/results/test=5Fbitmapset.out >> 2025-10-07 21:24:00.534142300 -0300 >> =40=40 -1570,9 +1570,5 =40=40 >> =C2=A0 >> =C2=A0-- random operations >> =C2=A0SELECT test=5Frandom=5Foperations(-1, 10000, 81920, 0) > 0 AS re= sult; >> - result >> --------- >> - t >> -(1 row) >> - >> +ERROR: =C2=A0union missing member 63904 >> =C2=A0DROP EXTENSION test=5Fbitmapset; >> =C2=A0 >> best regards, >> Ranier Vilela Thanks Ranier for the report. You're correct, the tests I wrote overlooked testing the return value and so were not accomplishing the goal of testing at all. Adding your small suggested patched turned over another flaw. The error message you were seeing was from later in that same function. > +ERROR: =C2=A0union missing member 63904 This was emitted by the code in the second portion of the randomized testing where there is a loop doing add/del/test operations. That error message was misleading as it matched the earlier error message near the change you made. But, thankfully that pointed to a second (face palm) flaw in that function (again, I take full credit/blame). The add/del/test loop wasn't accumulating the anticipated set of members and so was testing if the latest random int generated was in the set or not, which makes no sense. I've updated that loop to retain the list of members and the test to check against the retained list of members. I've updated the log message to be different from those above to avoid similar confusion in the future. This seems to be passing now, apologies for not paying closer attention to this code earlier on. best. -greg --68e6b1e3_6bd364f1_41f9 Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="v1-0001-Correct-flaws-in-randomized-Bitmapset-tests.patch" RnJvbSBlY2ZlNzcwZDRlZjgxMzlkNmY4NTJkZGU1MDM3YTdlYjUxNzE1ZTg5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBHcmVnIEJ1cmQgPGdyZWdAYnVyZC5tZT4KRGF0ZTogV2VkLCA4 IE9jdCAyMDI1IDE0OjI3OjMwIC0wNDAwClN1YmplY3Q6IFtQQVRDSCB2MV0gQ29ycmVjdCBmbGF3 cyBpbiByYW5kb21pemVkIEJpdG1hcHNldCB0ZXN0cwoKVGhlcmUgd2VyZSB0d28gb3ZlcnNpZ2h0 cyBpbiB0aGUgZnVuY3Rpb24gZGVzaWduYXRlZCB0byBwZXJmb3JtCnJhbmRvbWl6ZWQgdGVzdHMg YWdhaW5zdCBCaXRtYXBzZXQuICBGaXJzdCwgdGhlIHRlc3QgdmFsaWRhdGluZwpibXNfdW5pb24o KSB3YXMgbm90IGNoZWNraW5nIHRoZSByZXR1cm4gZnJvbSBibXNfaXNfbWVtYmVyKCkgYW5kIHNv Cndhc24ndCB0ZXN0aW5nIG11Y2ggYXQgYWxsLiAgU2Vjb25kLCBpbiB0aGUgc2Vjb25kIGhhbGYg b2YgdGhpcyBmdW5jdGlvbgpwZXJmb3JtaW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