--- PGBuild/Modules/TestUpgradeXversion.pm.orig	2024-11-02 01:47:21.000000000 -0400
+++ PGBuild/Modules/TestUpgradeXversion.pm	2025-02-22 12:11:31.924183704 -0500
@@ -419,7 +419,7 @@ sub test_upgrade    ## no critic (Subrou
 	# run in which it was set up, which will be gone by now, so we repoint
 	# it to the current run's tmpdir.
 	# listen_addresses will be set correctly and requires no adjustment.
-	if (!$using_localhost)
+	# In any case, disable autovacuum to prevent stats changing under us.
 	{
 		my $tdir = $tmpdir;
 		$tdir =~ s!\\!/!g;
@@ -431,7 +431,9 @@ sub test_upgrade    ## no critic (Subrou
 		$param = "unix_socket_directory"
 		  if $oversion ne 'HEAD' && $oversion lt 'REL9_3_STABLE';
 		print $opgconf "\n# Configuration added by buildfarm client\n\n";
-		print $opgconf "$param = '$tdir'\n";
+		print $opgconf "$param = '$tdir'\n"
+		    if (!$using_localhost);
+		print $opgconf "autovacuum = off\n";
 		close($opgconf);
 	}
 
@@ -507,7 +509,7 @@ sub test_upgrade    ## no critic (Subrou
 		  . qq{> "$upgrade_loc/$oversion-initdb.log" 2>&1});
 	return if $?;
 
-	unless ($using_localhost)
+	# Again, adjust connection location and disable autovacuum.
 	{
 		open(my $pgconf, ">>", "$installdir/$oversion-upgrade/postgresql.conf")
 		  || die "opening $installdir/$oversion-upgrade/postgresql.conf: $!";
@@ -515,8 +517,12 @@ sub test_upgrade    ## no critic (Subrou
 		$tmp_param = "unix_socket_directory"
 		  if $this_branch ne 'HEAD' && $this_branch lt 'REL9_3_STABLE';
 		print $pgconf "\n# Configuration added by buildfarm client\n\n";
-		print $pgconf "listen_addresses = ''\n";
-		print $pgconf "$tmp_param = '$tmpdir'\n";
+		unless ($using_localhost)
+		{
+		    print $pgconf "listen_addresses = ''\n";
+		    print $pgconf "$tmp_param = '$tmpdir'\n";
+		}
+		print $pgconf "autovacuum = off\n";
 		close($pgconf);
 	}
 
@@ -573,9 +579,9 @@ sub test_upgrade    ## no critic (Subrou
 	}
 	else
 	{
-		system( qq{"$installdir/bin/vacuumdb" --all --analyze-only }
-			  . qq{> "$upgrade_loc/$oversion-analyse.log" 2>&1 });
-		return if $?;
+#		system( qq{"$installdir/bin/vacuumdb" --all --analyze-only }
+#			  . qq{> "$upgrade_loc/$oversion-analyse.log" 2>&1 });
+#		return if $?;
 	}
 
 	if (-e "$installdir/reindex_hash.sql")
