diff --git a/PGBuild/Modules/TestUpgradeXversion.pm b/PGBuild/Modules/TestUpgradeXversion.pm
index 79c24c4..8aed93c 100644
--- a/PGBuild/Modules/TestUpgradeXversion.pm
+++ b/PGBuild/Modules/TestUpgradeXversion.pm
@@ -689,9 +689,26 @@ sub test_upgrade    ## no critic (Subroutines::ProhibitManyArgs)
 		return if $?;
 	}
 
-	system( qq{diff -I "^-- " -u "$upgrade_loc/origin-$oversion.sql" }
-		  . qq{"$upgrade_loc/converted-$oversion-to-$this_branch.sql" }
-		  . qq{> "$upgrade_loc/dumpdiff-$oversion" 2>&1});
+	foreach my $dump ("$upgrade_loc/origin-$oversion.sql",
+					 "$upgrade_loc/converted-$oversion-to-$this_branch.sql")
+	{
+		# would like to use lookbehind here but perl complains
+		# so do it this way
+		my $contents = file_contents($dump);
+		$contents =~ s/
+                         (^CREATE\sTRIGGER\s.*?)
+                         \sEXECUTE\sPROCEDURE
+                      /$1 EXECUTE FUNCTION/mgx;
+		open(my $dh, '>', "$dump.fixed") || die "opening $dump.fixed";
+		print $dh $contents;
+		close($dh);
+	}
+
+	system( qq{diff -I "^\$" -I "SET default_table_access_method = heap;" }
+		. qq{ -I "^SET default_toast_compression = 'pglz';\$" -I "^-- " }
+		. qq{-u "$upgrade_loc/origin-$oversion.sql.fixed" }
+		. qq{"$upgrade_loc/converted-$oversion-to-$this_branch.sql.fixed" }
+		. qq{> "$upgrade_loc/dumpdiff-$oversion" 2>&1});
 
 	# diff exits with status 1 if files differ
 	return if $? >> 8 > 1;
@@ -699,7 +716,10 @@ sub test_upgrade    ## no critic (Subroutines::ProhibitManyArgs)
 	open(my $diffile, '<', "$upgrade_loc/dumpdiff-$oversion")
 	  || die "opening $upgrade_loc/dumpdiff-$oversion: $!";
 	my $difflines = 0;
-	$difflines++ while <$diffile>;
+	while (<$diffile>)
+	{
+		$difflines++ if /^[+-]/;
+	}
 	close($diffile);
 
 	# If the versions match we expect a possible handful of diffs,
