diff options
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r-- | src/bin/psql/common.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 21d660a8961..3e4e444f3fd 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1478,6 +1478,23 @@ discardAbortedPipelineResults(void) */ return res; } + else if (res != NULL && result_status == PGRES_FATAL_ERROR) + { + /* + * Found a FATAL error sent by the backend, and we cannot recover + * from this state. Instead, return the last result and let the + * outer loop handle it. + */ + PGresult *fatal_res PG_USED_FOR_ASSERTS_ONLY; + + /* + * Fetch result to consume the end of the current query being + * processed. + */ + fatal_res = PQgetResult(pset.db); + Assert(fatal_res == NULL); + return res; + } else if (res == NULL) { /* A query was processed, decrement the counters */ |