Adapt pg_upgrade test to pg_lsn output format difference
authorÁlvaro Herrera
Mon, 7 Jul 2025 20:38:12 +0000 (22:38 +0200)
committerÁlvaro Herrera
Mon, 7 Jul 2025 20:38:40 +0000 (22:38 +0200)
Commit 2633dae2e487 added some zero padding to various LSNs output
routines so that the low word is always 8 hex digits long, for easy
human consumption.  This included the pg_lsn datatype, which breaks the
pg_upgrade test when it compares the pg_dump output of an older version.
Silence this problem by setting the pg_lsn columns to NULL before the
upgrade.

Discussion: https://postgr.es/m/202507071504[email protected]

src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

index 1725fe2f94871506d8bfce0579e4b65276803b29..7224c286e1df4f5f44fbea528b13b4bf43242649 100644 (file)
@@ -251,6 +251,32 @@ sub adjust_database_contents
            'drop operator if exists public.=> (bigint, NONE)');
    }
 
+   # Version 19 changed the output format of pg_lsn.  To avoid output
+   # differences, set all pg_lsn columns to NULL if the old version is
+   # older than 19.
+   if ($old_version < 19)
+   {
+       if ($old_version >= '9.5')
+       {
+           _add_st($result, 'regression',
+               "update brintest set lsncol = NULL");
+       }
+
+       if ($old_version >= 12)
+       {
+           _add_st($result, 'regression',
+               "update tab_core_types set pg_lsn = NULL");
+       }
+
+       if ($old_version >= 14)
+       {
+           _add_st($result, 'regression',
+               "update brintest_multi set lsncol = NULL");
+           _add_st($result, 'regression',
+               "update brintest_bloom set lsncol = NULL");
+       }
+   }
+
    return $result;
 }