aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/BackgroundPsql.pm')
-rw-r--r--src/test/perl/PostgreSQL/Test/BackgroundPsql.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
index c7a3d3e920d..2216918b253 100644
--- a/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
+++ b/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
@@ -236,8 +236,10 @@ sub query
die "psql query timed out" if $self->{timeout}->is_expired;
$output = $self->{stdout};
- # remove banner again, our caller doesn't care
- $output =~ s/\n$banner\n$//s;
+ # Remove banner again, our caller doesn't care. The first newline is
+ # optional, as there would not be one if consuming an empty query
+ # result.
+ $output =~ s/\n?$banner\n$//s;
# clear out output for the next query
$self->{stdout} = '';