diff options
Diffstat (limited to 'src/test/perl/PostgresNode.pm')
| -rw-r--r-- | src/test/perl/PostgresNode.pm | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index fede1e601b9..afbdb6332bd 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -243,7 +243,13 @@ sub connstr { return "port=$pgport host=$pghost"; } - return "port=$pgport host=$pghost dbname=$dbname"; + + # Escape properly the database string before using it, only + # single quotes and backslashes need to be treated this way. + $dbname =~ s#\\#\\\\#g; + $dbname =~ s#\'#\\\'#g; + + return "port=$pgport host=$pghost dbname='$dbname'"; } =pod @@ -396,7 +402,8 @@ sub init mkdir $self->backup_dir; mkdir $self->archive_dir; - TestLib::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust', '-N'); + TestLib::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust', '-N', + @{ $params{extra} }); TestLib::system_or_bail($ENV{PG_REGRESS}, '--config-auth', $pgdata); open my $conf, ">>$pgdata/postgresql.conf"; @@ -1300,6 +1307,24 @@ sub issues_sql_like =pod +=item $node->run_log(...) + +Runs a shell command like TestLib::run_log, but with PGPORT set so +that the command will default to connecting to this PostgresNode. + +=cut + +sub run_log +{ + my $self = shift; + + local $ENV{PGPORT} = $self->port; + + TestLib::run_log(@_); +} + +=pod + =back =cut |
