postgres.git / summary / log / commit / refs

commit    19a2002b5db959e095926d74d46be4b8aa7f20a2
Author:   Andres Freund <andres@anarazel.de>
Date:     Fri Oct 30 20:20:52 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 7049aa3128b..a2930fd1f2f 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -631,12 +631,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: f9d7dee5f73c]