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 1uyEUI-005Oiv-QJ for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Sep 2025 19:03:43 +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 1uyEUG-00DAgQ-Cy for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Sep 2025 19:03:41 +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 1uyEUF-00DAg2-Id for pgsql-hackers@lists.postgresql.org; Mon, 15 Sep 2025 19:03:40 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uyEUD-000aYD-1i for pgsql-hackers@lists.postgresql.org; Mon, 15 Sep 2025 19:03:39 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id C96B514000E2; Mon, 15 Sep 2025 15:03:36 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Mon, 15 Sep 2025 15:03:36 -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=fm1; t=1757963016; x=1758049416; bh=KIW/ooK05V03pR0MbfCv8SUOZroLpdGmZDX0Vs/ABZ8=; b= paFCrsk6ayCJz2UiFze+QFS6Ox8MMhCViTgPD+tUSgeHAFBFlI+ktKEJAQJ+cY/C ksBVqzifWHNm15Y6dMlqGkKvrmA+Ec6wULYj/SSSP8baGQGcdeNIqRhEcq5zIrNp Ck6lKG60HcU3hSPuGv9KvvdZE26T63l6hXr9q/hBoGKrxaSXrFFg/6eqcmuR3dkR YVN4VAMlopD8NKBgUo9UKSQXMpxxn44ECwl48wjQGnB/NXpFx4gT8lhqY6kVjyYU lyn148BmXrzFhLGilv6GwG8iiiOlm9uVZ1tYCgTwmb0bnNRKFtqO9a1xfhOfjErY j4n2SC9wjqz4s4ZF4S7tvA== 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=fm1; t=1757963016; x= 1758049416; bh=KIW/ooK05V03pR0MbfCv8SUOZroLpdGmZDX0Vs/ABZ8=; b=T n+29huEsWbA6+ettTszXgz2HE4LVq7+4NO8QL+o4GmV02ptLtElHevHEcPv2j9Of APrMSffejOJB03cpyNCRrPyztzczKb+wP3IdrVti4aFVahkFG8AVnFjIfp4QvP/U 2zGD3DRZtRUQ3eFAq8MDZDtajisDWUax/dAllen9ks4I9LrsQl4uNG3gI841xNhW 6yqyW2zCXUSjyCgeDnHrA2/FB0qMHriAZ+RorYTJWHtRjwV/NFFzchzL+MogT3eX VQTnBHECOd+b8j25nht85DKSAqjv1wH/VwK+tLbRLzCd1AYZUxezqQsPrm4DZqsu P9hqUGbYNA5Wi9t0e/8qA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefkeegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefkjghfuffogggtgfgusehtqhhmtdertdejnecuhfhrohhmpefirhgvghcu uehurhguuceoghhrvghgsegsuhhrugdrmhgvqeenucggtffrrghtthgvrhhnpeehfeefje ektdekjeejveffkeeguedtkeeftdfgieelgeehgffftdduleevkefggeenucffohhmrghi nhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepghhrvghgsegsuhhrugdrmhgvpdhnsggprhgtphht thhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehrohgsvghrthhmhhgrrg hssehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhi shhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepnhgrthhhrghnuggsoh hsshgrrhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepshgrfigruggrrdhmshhhkhes ghhmrghilhdrtghomhdprhgtphhtthhopehmihgthhgrvghlsehprghquhhivghrrdighi ii X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Sep 2025 15:03:36 -0400 (EDT) Date: Mon, 15 Sep 2025 15:03:21 -0400 From: Greg Burd To: Robert Haas Cc: PostgreSQL Hackers , Nathan Bossart , Masahiko Sawada , Michael Paquier Message-ID: <0FE0B26D-B94A-4BA7-BCA4-338C020609D9@greg.burd.me> In-Reply-To: References: Subject: Re: [PATCH] Add tests for Bitmapset X-Mailer: Mailspring MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sep 15 2025, at 2:54 pm, Robert Haas wrote: > On Mon, Sep 15, 2025 at 2:00=E2=80=AFPM Greg Burd wrot= e: >> =46or reference radixtree has: >> =20 >> coverage: HEAD >> lines......: 98.3 >> functions..: 97.2 >> branches...: 89.4 > =20 > + /* Test negative member in bms=5Fmake=5Fsingleton */ > + error=5Fcaught =3D false; > + PG=5FTRY(); > + =7B > + bms=5Fmake=5Fsingleton(-1); > + =7D > + PG=5FCATCH(); > + =7B > + error=5Fcaught =3D true; > + =46lushErrorState(); > + =7D > + PG=5FEND=5FTRY(); > + EXPECT=5FTRUE(error=5Fcaught); > =20 > This is an anti-pattern for PostgreSQL code. You can't just flush an > error without aborting a transaction or subtransaction to recover. > Even if it could be shown that this were harmless here, I think it's a > terrible idea to have code like this in the tree, as it encourages > people to do exactly the wrong thing. =46air enough, I'll rework it. =20 > But backing up a step, this also doesn't really seem like the right > way to test the error conditions. It deliberately throws away the > error message. All this verifies is that you caught an error. If you > let the error escape to the client you could have the expected output > test that you got the expected message. > =20 > I think it would be a better idea to structure this as a set of > SQL-callable functions and move a bunch of the logic into SQL. I'll give that approach a try, thanks for the suggestion. -greg > -- =20 > Robert Haas > EDB: http://www.enterprisedb.com