postgres.git / summary / log / commit / refs
commit 609fa63db6d1e1f2c27a6dd31e9ac8d3b7bcae03
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri Jun 30 16:22:33 2017 +0000
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 2f0ed035fc6..93dd7b5c176 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);
[parent: fca85f8ef157]