diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-03-07 16:56:42 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-03-07 16:56:42 -0500 |
commit | cf7026b64b3e56889f8a81194a57221500e23a0f (patch) | |
tree | 9088683ac5ad492a816638c5851565c129714ad7 /src/bin/psql/common.c | |
parent | 1673122127f9f17f4ca6b214027c0806b0d502f4 (diff) | |
download | postgresql-cf7026b64b3e56889f8a81194a57221500e23a0f.tar.gz postgresql-cf7026b64b3e56889f8a81194a57221500e23a0f.zip |
psql: Avoid some spurious output if the server croaks.
Fixes a regression in commit 08146775acd8bfe0fcc509c71857abb928697171.
Noah Misch
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r-- | src/bin/psql/common.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 5c9bd960022..715e23167de 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -740,7 +740,7 @@ ProcessResult(PGresult **results) } while (next_result); /* may need this to recover from conn loss during COPY */ - if (!CheckConnection()) + if (!first_cycle && !CheckConnection()) return false; return success; @@ -1015,8 +1015,10 @@ SendQuery(const char *query) case PQTRANS_UNKNOWN: default: OK = false; - psql_error("unexpected transaction status (%d)\n", - transaction_status); + /* PQTRANS_UNKNOWN is expected given a broken connection. */ + if (transaction_status != PQTRANS_UNKNOWN || ConnectionUp()) + psql_error("unexpected transaction status (%d)\n", + transaction_status); break; } |