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 1rj0pm-002x9r-7d for pgsql-committers@arkaria.postgresql.org; Sat, 09 Mar 2024 17:50:10 +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 1rj0pi-001cGH-K9 for pgsql-committers@arkaria.postgresql.org; Sat, 09 Mar 2024 17:50:07 +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 1rj0pi-001cG9-4I for pgsql-committers@lists.postgresql.org; Sat, 09 Mar 2024 17:50:06 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rj0pa-003fZQ-DR for pgsql-committers@lists.postgresql.org; Sat, 09 Mar 2024 17:50:05 +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 429HnvC41066873; Sat, 9 Mar 2024 12:49:57 -0500 From: Tom Lane To: Jeff Davis cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack. In-reply-to: References: Comments: In-reply-to Jeff Davis message dated "Fri, 08 Mar 2024 23:48:08 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1066871.1710006597.1@sss.pgh.pa.us> Date: Sat, 09 Mar 2024 12:49:57 -0500 Message-ID: <1066872.1710006597@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > Ever since this commit the cross-version upgrade test is failing (for > me, at least) with: > # Running: psql -X -v ON_ERROR_STOP=1 -c drop database if exists > contrib_regression_adminpack; > drop database if exists regression_adminpack -d port=53977 > host=/tmp/EK6UT_TufI dbname='postgres' > ERROR: DROP DATABASE cannot run inside a transaction block Ugh. > I'm not sure how this test is succeeding for others, so perhaps I'm > doing something wrong? I've only tested it in the context of the buildfarm's script, which implements this by dumping the given commands into a temp file and invoking psql with -f. So that's fine with multiple DROP DATABASE commands, but what 002_pg_upgrade.pl is doing isn't. I guess you are running that in some way that the rest of us aren't. > Patch attached, though I'm not particularly great with perl and the > array flattening in my implementation might be too magical. I'm no perl maven either, but this looks fine to me. Now that I look at it, I see that I missed a bet in the additions to AdjustUpgrade.pm: rather than using IF EXISTS it should be doing something more like the pre-existing logic if ($dbnames{"contrib_regression_$bad_module"}) { _add_st($result, 'postgres', "drop database contrib_regression_$bad_module"); delete($dbnames{"contrib_regression_$bad_module"}); } However, we'd inevitably hit the more-than-one-DB-to-drop problem eventually, so better to fix that now. Please push your fix and then I'll clean up the unnecessary DROPs. regards, tom lane