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} = '';
my $pid = $bgpsql->query('SELECT pg_backend_pid()');
# create the database, prevent drop database via lock held by a 2PC transaction
-ok( $bgpsql->query_safe(
- qq(
+$bgpsql->query_safe(
+ qq(
CREATE DATABASE regression_invalid_interrupt;
BEGIN;
LOCK pg_tablespace;
- PREPARE TRANSACTION 'lock_tblspc';)),
- "blocked DROP DATABASE completion");
+ PREPARE TRANSACTION 'lock_tblspc';));
# Try to drop. This will wait due to the still held lock.
$bgpsql->query_until(qr//, "DROP DATABASE regression_invalid_interrupt;\n");
# To properly drop the database, we need to release the lock previously preventing
# doing so.
-ok($bgpsql->query_safe(qq(ROLLBACK PREPARED 'lock_tblspc')),
- "unblock DROP DATABASE");
-
-ok($bgpsql->query(qq(DROP DATABASE regression_invalid_interrupt)),
- "DROP DATABASE invalid_interrupt");
+$bgpsql->query_safe(qq(ROLLBACK PREPARED 'lock_tblspc'));
+$bgpsql->query_safe(qq(DROP DATABASE regression_invalid_interrupt));
$bgpsql->quit();