aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-02-26 16:36:11 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2025-02-26 16:36:20 -0500
commit40e27d04b4f643cfb78af8db42a1f2e700ec9876 (patch)
tree80c8df6b40ca3eaec64fcebfff9eb4c3cd2fd824 /src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
parentf734c9fc3a91959c2473a1e33fd9b60116902175 (diff)
downloadpostgresql-40e27d04b4f643cfb78af8db42a1f2e700ec9876.tar.gz
postgresql-40e27d04b4f643cfb78af8db42a1f2e700ec9876.zip
Use attnum to identify index columns in pg_restore_attribute_stats().
Previously we used attname for both table and index columns, but that is problematic for indexes because their attnames are assigned by internal rules that don't guarantee to preserve the names across dump and reload. (This is what's causing the remaining buildfarm failures in cross-version-upgrade tests.) Fortunately we can use attnum instead, since there's no such thing as adding or dropping columns in an existing index. We met this same problem previously with ALTER INDEX ... SET STATISTICS, and solved it the same way, cf commit 5b6d13eec. In pg_restore_attribute_stats() itself, we accept either attnum or attname, but the policy used by pg_dump is to always use attname for tables and attnum for indexes. Author: Tom Lane <tgl@sss.pgh.pa.us> Author: Corey Huinker <corey.huinker@gmail.com> Discussion: https://postgr.es/m/1457469.1740419458@sss.pgh.pa.us
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm')
-rw-r--r--src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
index 0a707c69c5c..ec874852d12 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
@@ -345,7 +345,7 @@ sub adjust_old_dumpfile
{
$dump =~ s/
(^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
- \s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
+ [^;]*'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
[^;]*'relallvisible',)\s'\d+'::integer
/$1 ''::integer/mgx;
}
@@ -692,7 +692,7 @@ sub adjust_new_dumpfile
{
$dump =~ s/
(^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
- \s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
+ [^;]*'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
[^;]*'relallvisible',)\s'\d+'::integer
/$1 ''::integer/mgx;
}