From 80da124a4f338a612550180dac86eb33850e2254 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 20 Oct 2026 18:49:30 -0400 Subject: [PATCH] Fix cross-version upgrade tests for commits 0497318e4 et al. Dumps taken from unpatched versions (pre-v14) will not have the AS keyword that ruleutils.c now prints, causing a harmless diff in dump output. Adjust the cross-version upgrade's old dump to make it match. While I'm here, move the stanza that I hastily put in a non-optimal place in commit f8ab6c622. It's worth fixing because it messed up the logical structure of adjust_database_contents, making it un-obvious where to put future additions. Per buildfarm. --- .../perl/PostgreSQL/Test/AdjustUpgrade.pm | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm index bf8ed7144d5..040dc934cf8 100644 --- a/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm +++ b/src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm @@ -112,25 +112,6 @@ sub adjust_database_contents 'drop extension if exists test_ext7'); } - # We can no longer upgrade bpchar indexes that claim deduplication ability - # (amcheck will complain about them), so drop them if source is pre-v14. - if ($old_version < 14) - { - if ($dbnames{"regression"}) - { - _add_st($result, 'regression', - 'drop index if exists public.hslot_hubname', - 'drop index if exists public.hslot_name', - 'drop index if exists public.hub_name', - 'drop index if exists public.iface_name', - 'drop index if exists public.phone_name', - 'drop index if exists public.pline_name', - 'drop index if exists public.pslot_name', - 'drop index if exists public.room_rno', - 'drop index if exists public.wslot_name'); - } - } - # we removed this test-support function in v17 if ($old_version >= 15 && $old_version < 17) { @@ -184,6 +165,22 @@ sub adjust_database_contents _add_st($result, 'contrib_regression_seg', "delete from test_seg where s = '4.6 .. ~7.0'"); } + + # We can no longer upgrade bpchar indexes that claim deduplication + # ability (amcheck will complain about them) + if ($dbnames{'regression'}) + { + _add_st($result, 'regression', + 'drop index if exists public.hslot_hubname', + 'drop index if exists public.hslot_name', + 'drop index if exists public.hub_name', + 'drop index if exists public.iface_name', + 'drop index if exists public.phone_name', + 'drop index if exists public.pline_name', + 'drop index if exists public.pslot_name', + 'drop index if exists public.room_rno', + 'drop index if exists public.wslot_name'); + } } # user table OIDs are gone from release 12 on @@ -349,6 +346,17 @@ sub adjust_old_dumpfile {$1;}mxg; } + if ($old_version < 14) + { + # Fix up some rule definitions that ruleutils now prints with AS. + $dump =~ s {DO INSTEAD UPDATE public\.rules_log trgt SET tag} + {DO INSTEAD UPDATE public.rules_log AS trgt SET tag}; + $dump =~ s {UPDATE public\.int4_tbl trgt_1 SET} + {UPDATE public.int4_tbl AS trgt_1 SET}; + $dump =~ s {DELETE FROM public\.int4_tbl trgt_1} + {DELETE FROM public.int4_tbl AS trgt_1}; + } + # Change trigger definitions to say ... EXECUTE FUNCTION ... if ($old_version < 12) {