diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index 7509b4fe60a..f6fa0e4c16a 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -591,13 +591,19 @@ libpqrcv_PQexec(PGconn *streamConn, const char *query) ResetLatch(MyLatch); CHECK_FOR_INTERRUPTS(); } + + /* Consume whatever data is available from the socket */ if (PQconsumeInput(streamConn) == 0) - return NULL; /* trouble */ + { + /* trouble; drop whatever we had and return NULL */ + PQclear(lastResult); + return NULL; + } } /* - * Emulate the PQexec()'s behavior of returning the last result when - * there are many. We are fine with returning just last error message. + * Emulate PQexec()'s behavior of returning the last result when there + * are many. We are fine with returning just last error message. */ result = PQgetResult(streamConn); if (result == NULL) |