Skip to content

Commit 5194431

Browse files
committed
Simplify and merge unwanted-module drop logic in AdjustUpgrade.pm.
In be78006 and followups, we failed to notice that there was already a better way to do it: instead of using DROP DATABASE IF EXISTS, we can check the list of existing DBs. Also, there seems no reason not to merge this into the pre-existing code for getting rid of unwanted module databases. Discussion: https://postgr.es/m/1066872.1710006597@sss.pgh.pa.us
1 parent 76904ed commit 5194431

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,20 @@ sub adjust_database_contents
8686

8787
# remove dbs of modules known to cause pg_upgrade to fail
8888
# anything not builtin and incompatible should clean up its own db
89-
foreach my $bad_module ('test_ddl_deparse', 'tsearch2')
89+
foreach my $bad_module ('adminpack', 'test_ddl_deparse', 'tsearch2')
9090
{
9191
if ($dbnames{"contrib_regression_$bad_module"})
9292
{
9393
_add_st($result, 'postgres',
9494
"drop database contrib_regression_$bad_module");
9595
delete($dbnames{"contrib_regression_$bad_module"});
9696
}
97+
if ($dbnames{"regression_$bad_module"})
98+
{
99+
_add_st($result, 'postgres',
100+
"drop database regression_$bad_module");
101+
delete($dbnames{"regression_$bad_module"});
102+
}
97103
}
98104

99105
# avoid no-path-to-downgrade-extension-version issues
@@ -106,17 +112,6 @@ sub adjust_database_contents
106112
'drop extension if exists test_ext7');
107113
}
108114

109-
# we removed the adminpack extension in v17
110-
if ($old_version < 17)
111-
{
112-
_add_st($result, 'postgres',
113-
'drop database if exists contrib_regression_adminpack');
114-
_add_st($result, 'postgres',
115-
'drop database if exists regression_adminpack');
116-
delete($dbnames{'contrib_regression_adminpack'});
117-
delete($dbnames{'regression_adminpack'});
118-
}
119-
120115
# we removed this test-support function in v17
121116
if ($old_version >= 15 && $old_version < 17)
122117
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy