Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion check_postgres.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ sub run_command {
local $SIG{ALRM} = sub { die 'Timed out' };
alarm 0;

push @args, '-c', $string;
push @args, '-X', '-c', $string;

$VERBOSE >= 3 and warn Dumper \@args;

Expand Down
18 changes: 9 additions & 9 deletions t/CP_Testing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -225,37 +225,37 @@ sub test_database_handle {
my $COM;

$SQL = q{SELECT * FROM pg_database WHERE datname = 'postgres'};
my $res = qx{psql -Ax -qt -d template1 -q -h "$host" -c "$SQL"};
my $res = qx{psql -Ax -qt -d template1 -q -h "$host" -X -c "$SQL"};
if ($res !~ /postgres/) {
$COM = qq{psql -d template1 -q -h "$host" -c "CREATE DATABASE postgres"};
$COM = qq{psql -d template1 -q -h "$host" -X -c "CREATE DATABASE postgres"};
system $COM;
}

my $newuser = $self->{testuser};
$SQL = qq{SELECT * FROM pg_user WHERE usename = '$newuser'};
$res = qx{psql -Ax -qt -d template1 -q -h "$host" -c "$SQL"};
$res = qx{psql -Ax -qt -d template1 -q -h "$host" -X -c "$SQL"};
if ($res !~ /$newuser/) {
$COM = qq{psql -d template1 -q -h "$host" -c "CREATE USER $newuser"};
$COM = qq{psql -d template1 -q -h "$host" -X -c "CREATE USER $newuser"};
system $COM;
$SQL = qq{UPDATE pg_shadow SET usesuper='t' WHERE usename = '$newuser'};
$COM = qq{psql -d postgres -q -h "$host" -c "$SQL"};
$COM = qq{psql -d postgres -q -h "$host" -X -c "$SQL"};
system $COM;
}

$newuser = $self->{testuser2};
$SQL = qq{SELECT * FROM pg_user WHERE usename = '$newuser'};
$res = qx{psql -Ax -qt -d template1 -q -h "$host" -c "$SQL"};
$res = qx{psql -Ax -qt -d template1 -q -h "$host" -X -c "$SQL"};
if ($res !~ /$newuser/) {
$COM = qq{psql -d template1 -q -h "$host" -c "CREATE USER $newuser"};
$COM = qq{psql -d template1 -q -h "$host" -X -c "CREATE USER $newuser"};
system $COM;
$SQL = qq{UPDATE pg_shadow SET usesuper='t' WHERE usename = '$newuser'};
$COM = qq{psql -d postgres -q -h "$host" -c "$SQL"};
$COM = qq{psql -d postgres -q -h "$host" -X -c "$SQL"};
system $COM;
}

for my $lang (qw/plpgsql plperlu/) {
$SQL = qq{SELECT * FROM pg_language WHERE lanname = '$lang'};
$res = qx{psql -Ax -qt -d postgres -q -h "$host" -c "$SQL"};
$res = qx{psql -Ax -qt -d postgres -q -h "$host" -X -c "$SQL"};
if ($res !~ /$lang/) {
my $createlang = $ENV{PGBINDIR} ? "$ENV{PGBINDIR}/createlang" : 'createlang';
$COM = qq{$createlang -d postgres -h "$host" $lang};
Expand Down