aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-02-23 14:16:26 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2025-02-23 14:16:26 -0500
commitfc0d0ce978752493868496be6558fa17b7c4c3cf (patch)
tree041f65389fba4959dc3f389342c3cbdc94784f61 /src
parent454c182f8542890d0e2eac85f70d9a254a34fce3 (diff)
downloadpostgresql-fc0d0ce978752493868496be6558fa17b7c4c3cf.tar.gz
postgresql-fc0d0ce978752493868496be6558fa17b7c4c3cf.zip
Ignore hash's relallvisible when checking pg_upgrade from pre-v10.
Our cross-version upgrade tests have been failing for some pre-v10 source versions since commit 1fd1bd871. This turns out to be because relallvisible may change for tables that have hash indexes, because the upgrade process forcibly reindexes such indexes to deal with the changes made in v10. Fortunately, the set of tables that have such indexes is small and won't change anymore in those branches. So just hack up AdjustUpgrade.pm to not compare the relallvisible values of those specific tables. While here, also tighten the regex that suppresses comparison of version fields. Discussion: https://postgr.es/m/812817.1740277228@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index 64f1f910ebf..0a707c69c5c 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -296,8 +296,8 @@ sub adjust_old_dumpfile
# Same with version argument to pg_restore_relation_stats() or
# pg_restore_attribute_stats().
- $dump =~ s ['version', '\d+'::integer,]
- ['version', '000000'::integer,]mg;
+ $dump =~ s {(^\s+'version',) '\d+'::integer,$}
+ {$1 '000000'::integer,}mg;
if ($old_version < 16)
{
@@ -338,6 +338,18 @@ sub adjust_old_dumpfile
/$1 EXECUTE FUNCTION/mgx;
}
+ # During pg_upgrade, we reindex hash indexes if the source is pre-v10.
+ # This may change their tables' relallvisible values, so don't compare
+ # those.
+ if ($old_version < 10)
+ {
+ $dump =~ s/
+ (^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
+ \s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
+ [^;]*'relallvisible',)\s'\d+'::integer
+ /$1 ''::integer/mgx;
+ }
+
if ($old_version lt '9.6')
{
# adjust some places where we don't print so many parens anymore
@@ -633,8 +645,8 @@ sub adjust_new_dumpfile
# Same with version argument to pg_restore_relation_stats() or
# pg_restore_attribute_stats().
- $dump =~ s ['version', '\d+'::integer,]
- ['version', '000000'::integer,]mg;
+ $dump =~ s {(^\s+'version',) '\d+'::integer,$}
+ {$1 '000000'::integer,}mg;
# pre-v16 dumps do not know about XMLSERIALIZE(NO INDENT).
if ($old_version < 16)
@@ -673,6 +685,18 @@ sub adjust_new_dumpfile
$dump =~ s/^SET default_table_access_method = heap;\n//mg;
}
+ # During pg_upgrade, we reindex hash indexes if the source is pre-v10.
+ # This may change their tables' relallvisible values, so don't compare
+ # those.
+ if ($old_version < 10)
+ {
+ $dump =~ s/
+ (^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
+ \s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
+ [^;]*'relallvisible',)\s'\d+'::integer
+ /$1 ''::integer/mgx;
+ }
+
# dumps from pre-9.6 dblink may include redundant ACL settings
if ($old_version lt '9.6')
{