summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2023-12-06 00:54:47 +0000
committerMichael Paquier2023-12-06 00:54:47 +0000
commitbfc677c3bc31658957f601886352901fdd8c2811 (patch)
treedd0135b216d35168309890759d38f116ea8630a5
parent824dbea3e41efa3b35094163c834988dea7eb139 (diff)
Apply filters to dump files all the time in 002_pg_upgrade.pl
This commit removes the restriction that would not apply filters to the dumps used for comparison in the TAP test of pg_upgrade when using the same base version for the old and new nodes. The previous logic would fail on Windows if loading a dump while using the same set of binaries for the old and new nodes, as the library dependencies updated in the old dump would append CRLFs to the dump file as it is treated as a text file. The dump filtering logic replaces all CRLFs (\r\n) by LFs (\n), which is able to prevent this issue. When the old and new versions of the binaries are the same, AdjustUpgrade removes all blank lines, removes version-based comments generated by pg_dump and replaces CRLFs by LFs. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/60d434b9-53d9-9ea1-819b-efebdcf44e41@gmail.com Backpatch-through: 15
-rw-r--r--src/bin/pg_upgrade/t/002_pg_upgrade.pl12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index c6d83d3c211..997963082bd 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -437,15 +437,9 @@ push(@dump_command, '--extra-float-digits', '0')
if ($oldnode->pg_version < 12);
$newnode->command_ok(\@dump_command, 'dump after running pg_upgrade');
-# No need to apply filters on the dumps if working on the same version
-# for the old and new nodes.
-my $dump1_filtered = $dump1_file;
-my $dump2_filtered = $dump2_file;
-if ($oldnode->pg_version != $newnode->pg_version)
-{
- $dump1_filtered = filter_dump(1, $oldnode->pg_version, $dump1_file);
- $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
-}
+# Filter the contents of the dumps.
+my $dump1_filtered = filter_dump(1, $oldnode->pg_version, $dump1_file);
+my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
# Compare the two dumps, there should be no differences.
my $compare_res = compare($dump1_filtered, $dump2_filtered);