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

Commit6061ade

Browse files
alvherreadunstan
andcommitted
Compare only major versions in AdjustUpgrade.pm
Because PostgreSQL::Version is very nuanced about development versionnumbers, the comparison to 16beta2 makes it think that that release isolder than 16, therefore applying a database tweak that doesn't workthere (the comparison is only supposed to match when run on version 15).As suggested by Andrew Dunstan, fix by having AdjustUpgrade.pm publicmethods create a separate PostgreSQL::Version object to use for thesecomparisons, that only carries the major version number.While at it, have the same methods ensure that the objects given are ofthe expected type.Backpatch to 16. This module goes all the way back to 9.2, but there'sprobably no need for this fix except where betas still live.Co-authored-by: Andrew Dunstan <andrew@dunslane.net>Discussion:https://postgr.es/m/20230719110504.zbu74o54bqqlsufb@alvherre.pgsql
1 parente35cc3b commit6061ade

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ sub adjust_database_contents
7676
my ($old_version,%dbnames) =@_;
7777
my$result = {};
7878

79+
die"wrong type for\$old_version\n"
80+
unless$old_version->isa("PostgreSQL::Version");
81+
82+
# The version tests can be sensitive if fixups have been applied in a
83+
# recent version and pg_upgrade is run with a beta version, or such.
84+
# Therefore, use a modified version object that only contains the major.
85+
$old_version = PostgreSQL::Version->new($old_version->major);
86+
7987
# remove dbs of modules known to cause pg_upgrade to fail
8088
# anything not builtin and incompatible should clean up its own db
8189
foreachmy$bad_module ('test_ddl_deparse','tsearch2')
@@ -262,6 +270,11 @@ sub adjust_old_dumpfile
262270
{
263271
my ($old_version,$dump) =@_;
264272

273+
die"wrong type for\$old_version\n"
274+
unless$old_version->isa("PostgreSQL::Version");
275+
# See adjust_database_contents about this
276+
$old_version = PostgreSQL::Version->new($old_version->major);
277+
265278
# use Unix newlines
266279
$dump =~s/\r\n/\n/g;
267280

@@ -579,6 +592,11 @@ sub adjust_new_dumpfile
579592
{
580593
my ($old_version,$dump) =@_;
581594

595+
die"wrong type for\$old_version\n"
596+
unless$old_version->isa("PostgreSQL::Version");
597+
# See adjust_database_contents about this
598+
$old_version = PostgreSQL::Version->new($old_version->major);
599+
582600
# use Unix newlines
583601
$dump =~s/\r\n/\n/g;
584602

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp