Skip to content

Commit cf7026b

Browse files
committed
psql: Avoid some spurious output if the server croaks.
Fixes a regression in commit 0814677. Noah Misch
1 parent 1673122 commit cf7026b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/psql/common.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ ProcessResult(PGresult **results)
740740
} while (next_result);
741741

742742
/* may need this to recover from conn loss during COPY */
743-
if (!CheckConnection())
743+
if (!first_cycle && !CheckConnection())
744744
return false;
745745

746746
return success;
@@ -1015,8 +1015,10 @@ SendQuery(const char *query)
10151015
case PQTRANS_UNKNOWN:
10161016
default:
10171017
OK = false;
1018-
psql_error("unexpected transaction status (%d)\n",
1019-
transaction_status);
1018+
/* PQTRANS_UNKNOWN is expected given a broken connection. */
1019+
if (transaction_status != PQTRANS_UNKNOWN || ConnectionUp())
1020+
psql_error("unexpected transaction status (%d)\n",
1021+
transaction_status);
10201022
break;
10211023
}
10221024

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy