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

Commitd35e293

Browse files
committed
Add parameter "connstr" to PostgreSQL::Test::Cluster::background_psql
Like for Cluster::psql, this can be handy to force the use of aconnection string with some values overriden, like a "host".Author: Aidar ImamovDiscussion:https://postgr.es/m/ecacb079efc533aed3c234cbcb5b07b6@postgrespro.ru
1 parent126ec0b commitd35e293

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,6 +2181,11 @@ returned. Set B<on_error_stop> to 0 to ignore errors instead.
21812181
Set a timeout for a background psql session. By default, timeout of
21822182
$PostgreSQL::Test::Utils::timeout_default is set up.
21832183
2184+
=itemconnstr =>B<value>
2185+
2186+
If set, use this as the connection string for the connection to the
2187+
backend.
2188+
21842189
=itemreplication =>B<value>
21852190
21862191
If set, addB<replication=value> to the conninfo string.
@@ -2204,14 +2209,21 @@ sub background_psql
22042209
my$replication =$params{replication};
22052210
my$timeout =undef;
22062211

2212+
# Build the connection string.
2213+
my$psql_connstr;
2214+
if (defined$params{connstr})
2215+
{
2216+
$psql_connstr =$params{connstr};
2217+
}
2218+
else
2219+
{
2220+
$psql_connstr =$self->connstr($dbname);
2221+
}
2222+
$psql_connstr .=defined$replication ?" replication=$replication" :"";
2223+
22072224
my@psql_params = (
22082225
$self->installed_command('psql'),
2209-
'-XAtq',
2210-
'-d',
2211-
$self->connstr($dbname)
2212-
. (defined$replication ?" replication=$replication" :""),
2213-
'-f',
2214-
'-');
2226+
'-XAtq','-d',$psql_connstr,'-f','-');
22152227

22162228
$params{on_error_stop} = 1unlessdefined$params{on_error_stop};
22172229
$timeout =$params{timeout}ifdefined$params{timeout};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp