From 54e13ddb01b859606ebe938a98587aef666df668 Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Fri, 8 Mar 2024 23:37:16 -0800
Subject: [PATCH] Fix cross-version pg_upgrade test.

---
 src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index d951ed3af0..16b42d475f 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -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");
 	}
-- 
2.34.1

