Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc0d0ce

Browse files
committed
Ignore hash's relallvisible when checking pg_upgrade from pre-v10.
Our cross-version upgrade tests have been failing for some pre-v10source versions since commit1fd1bd8. This turns out to bebecause relallvisible may change for tables that have hash indexes,because the upgrade process forcibly reindexes such indexes todeal with the changes made in v10.Fortunately, the set of tables that have such indexes is smalland won't change anymore in those branches. So just hack upAdjustUpgrade.pm to not compare the relallvisible values ofthose specific tables.While here, also tighten the regex that suppresses comparisonof version fields.Discussion:https://postgr.es/m/812817.1740277228@sss.pgh.pa.us
1 parent454c182 commitfc0d0ce

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ sub adjust_old_dumpfile
296296

297297
# Same with version argument to pg_restore_relation_stats() or
298298
# pg_restore_attribute_stats().
299-
$dump =~s['version', '\d+'::integer,]
300-
['version','000000'::integer,]mg;
299+
$dump =~s{(^\s+'version',) '\d+'::integer,$}
300+
{$1'000000'::integer,}mg;
301301

302302
if ($old_version < 16)
303303
{
@@ -338,6 +338,18 @@ sub adjust_old_dumpfile
338338
/$1 EXECUTE FUNCTION/mgx;
339339
}
340340

341+
# During pg_upgrade, we reindex hash indexes if the source is pre-v10.
342+
# This may change their tables' relallvisible values, so don't compare
343+
# those.
344+
if ($old_version < 10)
345+
{
346+
$dump =~s/
347+
(^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
348+
\s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
349+
[^;]*'relallvisible',)\s'\d+'::integer
350+
/$1 ''::integer/mgx;
351+
}
352+
341353
if ($old_versionlt'9.6')
342354
{
343355
# adjust some places where we don't print so many parens anymore
@@ -633,8 +645,8 @@ sub adjust_new_dumpfile
633645

634646
# Same with version argument to pg_restore_relation_stats() or
635647
# pg_restore_attribute_stats().
636-
$dump =~s['version', '\d+'::integer,]
637-
['version','000000'::integer,]mg;
648+
$dump =~s{(^\s+'version',) '\d+'::integer,$}
649+
{$1'000000'::integer,}mg;
638650

639651
# pre-v16 dumps do not know about XMLSERIALIZE(NO INDENT).
640652
if ($old_version < 16)
@@ -673,6 +685,18 @@ sub adjust_new_dumpfile
673685
$dump =~s/^SET default_table_access_method = heap;\n//mg;
674686
}
675687

688+
# During pg_upgrade, we reindex hash indexes if the source is pre-v10.
689+
# This may change their tables' relallvisible values, so don't compare
690+
# those.
691+
if ($old_version < 10)
692+
{
693+
$dump =~s/
694+
(^SELECT\s\*\sFROM\spg_catalog\.pg_restore_relation_stats\(
695+
\s+'relation',\s'public\.hash_[a-z0-9]*_heap'::regclass,
696+
[^;]*'relallvisible',)\s'\d+'::integer
697+
/$1 ''::integer/mgx;
698+
}
699+
676700
# dumps from pre-9.6 dblink may include redundant ACL settings
677701
if ($old_versionlt'9.6')
678702
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp