Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phxGH-0001VE-9G for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Mar 2023 18:44:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phxGF-0004Be-M8 for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Mar 2023 18:44:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phxGF-0004BP-CS for pgsql-hackers@lists.postgresql.org; Thu, 30 Mar 2023 18:44:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phxGC-0004PA-UA for pgsql-hackers@postgresql.org; Thu, 30 Mar 2023 18:44:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32UIiUvq267901; Thu, 30 Mar 2023 14:44:30 -0400 From: Tom Lane To: Robert Haas cc: "pgsql-hackers@postgresql.org" Subject: Re: pgsql: Clean up role created in new subscription test. In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Thu, 30 Mar 2023 14:19:40 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <267899.1680201870.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 30 Mar 2023 14:44:30 -0400 Message-ID: <267900.1680201870@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Thu, Mar 30, 2023 at 1:07 PM Tom Lane wrote: >> This oversight broke repeated runs of "make installcheck". > GAAAAH. You would think that I would have learned better by now, but > evidently not. Is there some way we can add an automated guard against > this? Hm. We could add a final test step that prints out all still-existing roles, but the trick is to have it not fail in a legitimate installcheck context (ie, when there are indeed some pre-existing roles). Maybe it'd be close enough to expect there to be no roles named "regress_xxx". In combination with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, that would prevent us from accidentally leaving stuff behind, and we could hope that it doesn't cause false failures in real installations. Another idea could be for pg_regress to enforce that "select count(*) from pg_roles" gives the same answer before and after the test run. That would then be enforced against all pg_regress suites not just the main one, but perhaps that's good. Likewise for tablespaces, subscriptions, and other globally-visible objects, of course. regards, tom lane