postgres.git / summary / log / commit / refs

commit    4942dc745cf12368d2a927ae10bf7fada3bcbf26
Author:   Andres Freund <andres@anarazel.de>
Date:     Fri Oct 30 20:20:50 2026 +0000
First released in: 17.12, 18.7, 19.0

    tests: Don't use the initdb template for older installations
    
    Previously the initdb template was used even when creating a Cluster.pm
    instance for an old install. Obviously the current template is not right for
    that case.  The only reason we didn't notice before is because the existing
    cross-version tests, e.g. 002_pg_upgrade.pl, always pass initdb options for
    the old node.
    
    Oversight in 252dcb32397.
    
    Discussion: https://postgr.es/m/xhzif5hemvslxymzhk3ykdypwqvjm7pz5dm7taizgxgfjw6fwa@6gygmz5bdnc3
    Backpatch-through: 17


src/test/perl/PostgreSQL/Test/Cluster.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index da8d5516b53..f3a9583e42f 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -657,12 +657,15 @@ sub init # disabled, use a previously initdb'd cluster as a template by copying it. # For a lot of tests, that's substantially cheaper. It does not seem # worth figuring out whether extra parameters affect compatibility, so - # initdb is forced if any are defined. + # initdb is forced if any are defined. The template was created by the + # installation under test, so it can't be used for a node using a + # different installation. # # There's very similar code in pg_regress.c, but we can't easily # deduplicate it until we require perl at build time. if ( $params{force_initdb} or defined $params{extra} + or defined $self->{_install_path} or !defined $ENV{INITDB_TEMPLATE}) { note("initializing database system by running initdb"); [parent: bf8cc4278ade]