Fix connection leak in DROP SUBSCRIPTION command.

Previously the command forgot to close the connection to the publisher
when it failed to drop the replication slot.
This commit is contained in:
Fujii Masao 2017-02-22 03:36:02 +09:00
parent 1d04a59be3
commit 898a792eb8
1 changed files with 4 additions and 0 deletions

View File

@ -546,10 +546,14 @@ DropSubscription(DropSubscriptionStmt *stmt)
errdetail("The error was: %s", err)));
if (!walrcv_command(wrconn, cmd.data, &err))
{
/* Close the connection in case of failure */
walrcv_disconnect(wrconn);
ereport(ERROR,
(errmsg("could not drop the replication slot \"%s\" on publisher",
slotname),
errdetail("The error was: %s", err)));
}
else
ereport(NOTICE,
(errmsg("dropped replication slot \"%s\" on publisher",