From: Fujii Masao Date: Mon, 20 Jul 2026 12:40:31 +0000 (+0900) Subject: Allow PostgreSQL::Test::Cluster::start() to pass postmaster options X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1009339b3acaf06b457a8182bf50b504847a643c;p=thirdparty%2Fpostgresql.git Allow PostgreSQL::Test::Cluster::start() to pass postmaster options Previously, tests that needed extra postmaster command-line options had to invoke pg_ctl start directly, because PostgreSQL::Test::Cluster::start() provided no way to pass them. That bypassed the test framework's postmaster PID tracking, so a postmaster could be left running if the test failed after startup. Add an options parameter to PostgreSQL::Test::Cluster::start(), which is passed to pg_ctl's --options argument. This allows tests to use start() while preserving the framework's normal cleanup behavior. Author: Fujii Masao Reviewed-by: JoongHyuk Shin Discussion: https://postgr.es/m/CAHGQGwEpfE0CDUUODjBt7GO9U4ZF11hqga_Ci3wP8=O49oFKVw@mail.gmail.com --- diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 529f49efee1..3eae4cf6281 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -1139,6 +1139,12 @@ Start the node and wait until it is ready to accept connections. By default, failure terminates the entire F invocation. If given, instead return a true or false value to indicate success or failure. +=item options => B + +Additional postmaster options passed as the value of pg_ctl's C<--options> +argument. This must be a single string, quoted as needed by the caller. +Do not specify C; it is set from the node name. + =back =cut @@ -1150,6 +1156,12 @@ sub start my $pgdata = $self->data_dir; my $name = $self->name; my $ret; + my $options = ""; + + $options .= "$params{options} " + if defined $params{options} && $params{options} ne ""; + + $options .= "--cluster-name=$name"; BAIL_OUT("node \"$name\" is already running") if defined $self->{_pid}; @@ -1168,7 +1180,7 @@ sub start 'pg_ctl', '--wait', '--pgdata' => $self->data_dir, '--log' => $self->logfile, - '--options' => "--cluster-name=$name", + '--options' => $options, 'start'); if ($ret != 0)