diff --git a/src/bin/pg_upgrade/t/007_multixact_conversion.pl b/src/bin/pg_upgrade/t/007_multixact_conversion.pl index fe8da9aded2..14133eb3c7a 100644 --- a/src/bin/pg_upgrade/t/007_multixact_conversion.pl +++ b/src/bin/pg_upgrade/t/007_multixact_conversion.pl @@ -68,8 +68,8 @@ sub mxact_workload # versions. my $conn = $binnode->background_psql('', connstr => $node->connstr('postgres')); - $conn->query_safe("SET enable_seqscan=off"); - $conn->query_safe("BEGIN"); + $conn->query_safe("SET enable_seqscan=off", 0); + $conn->query_safe("BEGIN", 0); push(@connections, $conn); } @@ -110,7 +110,7 @@ sub mxact_workload ) as x ]; } - $conn->query_safe($sql); + $conn->query_safe($sql, 0); } for my $conn (@connections) diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm index 60bbd5dd445..9d62c7a00c0 100644 --- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm +++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm @@ -228,20 +228,24 @@ sub reconnect_and_clear Executes a query in the current session and returns the output in scalar context and (output, error) in list context where error is 1 in case there -was output generated on stderr when executing the query. +was output generated on stderr when executing the query. If C is +true (default) the query and its results are printed to the test output. =cut sub query { - my ($self, $query) = @_; + my ($self, $query, $verbose) = @_; my $ret; my $output; my $query_cnt = $self->{query_cnt}++; + # Set $verbose to true if not passed + $verbose = 1 unless defined($verbose); + local $Test::Builder::Level = $Test::Builder::Level + 1; - note "issuing query $query_cnt via background psql: $query"; + note "issuing query $query_cnt via background psql: $query" unless !$verbose; $self->{timeout}->start() if (defined($self->{query_timer_restart})); @@ -280,7 +284,7 @@ sub query explain { stdout => $self->{stdout}, stderr => $self->{stderr}, - }; + } unless !$verbose; # Remove banner from stdout and stderr, our caller doesn't care. The # first newline is optional, as there would not be one if consuming an @@ -308,9 +312,9 @@ Query failure is determined by it producing output on stderr. sub query_safe { - my ($self, $query) = @_; + my ($self, $query, $verbose) = @_; - my $ret = $self->query($query); + my $ret = $self->query($query, $verbose); if ($self->{stderr} ne "") {