From 609fa63db6d1e1f2c27a6dd31e9ac8d3b7bcae03 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Jun 2017 12:22:33 -0400 Subject: [PATCH] Check for error during PQendcopy. Oversight in commit 78c8c8143; noted while nosing around the walreceiver startup/shutdown code. --- src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index 2f0ed035fc..93dd7b5c17 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -459,7 +459,10 @@ libpqrcv_endstreaming(WalReceiverConn *conn, TimeLineID *next_tli) PQclear(res); /* End the copy */ - PQendcopy(conn->streamConn); + if (PQendcopy(conn->streamConn)) + ereport(ERROR, + (errmsg("error while shutting down streaming COPY: %s", + pchomp(PQerrorMessage(conn->streamConn))))); /* CommandComplete should follow */ res = PQgetResult(conn->streamConn); -- 2.40.0