diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index d101fa8c28d..d5d5757dd90 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -416,14 +416,20 @@ libpqrcv_PQexec(const char *query) */ if (!libpq_select(-1)) continue; /* interrupted */ + + /* 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. Since walsender will never generate multiple - * results, we skip the concatenation of error messages. + * Emulate PQexec()'s behavior of returning the last result when there + * are many. Since walsender will never generate multiple results, we + * skip the concatenation of error messages. */ result = PQgetResult(streamConn); if (result == NULL) |