Fix cross-version pg_upgrade test.
authorJeff Davis <jdavis@postgresql.org>
Sat, 9 Mar 2024 19:48:52 +0000 (11:48 -0800)
committerJeff Davis <jdavis@postgresql.org>
Sat, 9 Mar 2024 19:50:04 +0000 (11:50 -0800)
Pass each statement as a separate '-c' arg, so they don't get combined
into a single transaction.

Discussion: https://postgr.es/m/bca97aecb50b2026b7dbc26604bf31861c819a64.camel@j-davis.com
Reviewed-by: Tom Lane
src/bin/pg_upgrade/t/002_pg_upgrade.pl

index d951ed3af0bbc448d249b170d0818b6d5c26f71e..16b42d475fd0063273adb2e5a9daf2189d086f4e 100644 (file)
@@ -246,15 +246,19 @@ if (defined($ENV{oldinstall}))
 
        foreach my $updb (keys %$adjust_cmds)
        {
-               my $upcmds = join(";\n", @{ $adjust_cmds->{$updb} });
+               my @command_args = ();
+               for my $upcmd (@{ $adjust_cmds->{$updb} })
+               {
+                       push @command_args, '-c', $upcmd;
+               }
 
                # For simplicity, use the newer version's psql to issue the commands.
                $newnode->command_ok(
                        [
                                'psql', '-X',
                                '-v', 'ON_ERROR_STOP=1',
-                               '-c', $upcmds,
                                '-d', $oldnode->connstr($updb),
+                               @command_args,
                        ],
                        "ran version adaptation commands for database $updb");
        }