Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.
Date: 2024-03-09 17:49:57
Message-ID: 1066872.1710006597@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Jeff Davis <pgsql(at)j-davis(dot)com> 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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2024-03-09 19:50:16 pgsql: Fix cross-version pg_upgrade test.
Previous Message Jeff Davis 2024-03-09 07:48:08 Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.