Check for error during PQendcopy.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Jun 2017 16:22:33 +0000 (12:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Jun 2017 16:22:33 +0000 (12:22 -0400)
Oversight in commit 78c8c8143; noted while nosing around the
walreceiver startup/shutdown code.

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

index 2f0ed035fc6f2431d8b44cad63ac785785f74b9e..93dd7b5c176959b8f916433a1e7712a5b34c2c48 100644 (file)
@@ -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);