aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r--src/interfaces/libpq/fe-exec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 3a8cddf4ff4..b603ecfe7c7 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -1761,10 +1761,14 @@ PQisBusy(PGconn *conn)
parseInput(conn);
/*
- * PQgetResult will return immediately in all states except BUSY, or if we
- * had a write failure.
+ * PQgetResult will return immediately in all states except BUSY. Also,
+ * if we've detected read EOF and dropped the connection, we can expect
+ * that PQgetResult will fail immediately. Note that we do *not* check
+ * conn->write_failed here --- once that's become set, we know we have
+ * trouble, but we need to keep trying to read until we have a complete
+ * server message or detect read EOF.
*/
- return conn->asyncStatus == PGASYNC_BUSY || conn->write_failed;
+ return conn->asyncStatus == PGASYNC_BUSY && conn->status != CONNECTION_BAD;
}