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 1uyELi-005NTV-Ns for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Sep 2025 18:54:50 +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 1uyELf-00D4C2-Gk for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Sep 2025 18:54:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyELf-00D4Bu-7B for pgsql-hackers@lists.postgresql.org; Mon, 15 Sep 2025 18:54:48 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uyELa-000zgZ-0n for pgsql-hackers@lists.postgresql.org; Mon, 15 Sep 2025 18:54:46 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-b0787fa12e2so648609166b.2 for ; Mon, 15 Sep 2025 11:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757962478; x=1758567278; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=STOP/wWQRcUAYg88u33BJYZvMhWi4eWykG5/GR8mYHI=; b=X9DWFP9KoI9ArLWrzH8foTDbimL0CiZ/vkYvlfrHe4Q52SeEzX0BIkSRqd4xd82rFP G6L8SIhS8eDzbfRL0k6h2cHWCbv6se5WmWbweXgoD2vTuuZoyeCw47HtN0punRjFU0ny 6QwmCen9Pg6uzSKwnNyZXTCgz+ooIdgmK45cH6vOtsCaz/zKQKcvqpJZUIcl6IGunzG+ INgJHcoJFejn3itg3nxJ2XwoqGgCnjoDDxK1wru3BDgHNNoNv8v1VjF1m+obWcoGXO1n ipJ73Nl4l20kuqOTsGMiiDeScs4VUQfavyaZfk7Kt0r6HtkX05GqxdWOdOiEiBZT2vhi D/CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757962478; x=1758567278; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=STOP/wWQRcUAYg88u33BJYZvMhWi4eWykG5/GR8mYHI=; b=h0a7hAfjLnkt1yIzj6+kNxDYdkWLrurtYpM0UDuEuMuI8zoXMSYN0+EFpE/Y5nAYsi hGDQ0iIT7z3ojE4cwtNmmd43ue1N6QG3Mk4dJGvqwg3Q9zdi3Yww52/k+Fq5IIyfXqOb kP3W553MDzLl3IAcG574jd2EAI0nLBQ2U3I8U8HFBmRccY2euS7KLR83YyB1SJMakUva smaptnr9k5YjBXayVdsFVLOGQJ4a/3FEfgnO+sQ31AxVsL7LXK43hdoZ/DTqicdJLm2x 8FXM41V/PBqBHM4YkR+eRgcJMGEKgHdVqzx0ve7Ym+ieXZ2/F7dyicYCNybmpOS2iWML QvFQ== X-Gm-Message-State: AOJu0YzelPz/85EHJeq2jhURDUBHm3WONbaXs+I7im9IthLZqIHKH8f7 pwyerjHiAmdakLlS0mKTEFE67Sc33+GMcf8PCk9JSnhfAz9QdQcz+FUvoC+okW4ak/2VhZRfI+P cF4BhZOM8hwvkFid3dzggLTUmOv4eq2k= X-Gm-Gg: ASbGncuIl0FQTscqiKWO1KpaTHSdZfjQt3yuQbz8LTfUADO1NRh4uKrvk7nsnUz2rh2 QsQZ+cfn6sIK4uIiE6AtUBmolOEXxMjsCq+EDA/X622R7hZRuAUPVlbP2T3aA0xBWsb8S+Lgmpz 858GYcf5hRa2kf2VHaJmgftFsoV83gusKv/U4RBFYNZnbrndoICMFw3qJju76q/xYuAuxOwzRuu OS2SjEnffSIDAMv4LY= X-Google-Smtp-Source: AGHT+IFQNK/Y06q6ehPE8V7x1U7RyrR8vIFF7GX0p2ZWluXMgP1JAK6hEBWyGLN+WQjJkqZs/t0AcWCn9tF61GbJ9Ww= X-Received: by 2002:a17:907:3ea6:b0:b09:48c6:b7ad with SMTP id a640c23a62f3a-b0948c6c6a4mr982745866b.57.1757962477793; Mon, 15 Sep 2025 11:54:37 -0700 (PDT) MIME-Version: 1.0 References: <20200C9C-8DA3-413F-AE9A-60D6761DD060@burd.me> In-Reply-To: From: Robert Haas Date: Mon, 15 Sep 2025 14:54:25 -0400 X-Gm-Features: AS18NWBLbMizJpKr-kVJAJrbxFcGx5Xj_ugMhu8RbIV7iD-HMhJc2GB3LSuskf8 Message-ID: Subject: Re: [PATCH] Add tests for Bitmapset To: Greg Burd Cc: PostgreSQL Hackers , Nathan Bossart , Masahiko Sawada , Michael Paquier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Sep 15, 2025 at 2:00=E2=80=AFPM Greg Burd wrote: > For reference radixtree has: > > coverage: HEAD > lines......: 98.3 > functions..: 97.2 > branches...: 89.4 + /* Test negative member in bms_make_singleton */ + error_caught =3D false; + PG_TRY(); + { + bms_make_singleton(-1); + } + PG_CATCH(); + { + error_caught =3D true; + FlushErrorState(); + } + PG_END_TRY(); + EXPECT_TRUE(error_caught); 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. 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. 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. --=20 Robert Haas EDB: http://www.enterprisedb.com