postgres.git / summary / log / commit / refs
commit 32a85ee46b034be7b8bf8f31b24cf6fe3684fe7f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon Jun 06 15:26:57 2022 +0000
Don't fail on libpq-generated error reports in pg_amcheck.
An error PGresult generated by libpq itself, such as a report of
connection loss, won't have broken-down error fields.
should_processing_continue() blithely assumed that
PG_DIAG_SEVERITY_NONLOCALIZED would always be present, and would
dump core if it wasn't.
Per grepping to see if 6d157e7cb's mistake was repeated elsewhere.
src/bin/pg_amcheck/pg_amcheck.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index b4ce47a2e95..2c86ddae21f 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -958,6 +958,8 @@ should_processing_continue(PGresult *res)
/* This is expected but requires closer scrutiny */
case PGRES_FATAL_ERROR:
severity = PQresultErrorField(res, PG_DIAG_SEVERITY_NONLOCALIZED);
+ if (severity == NULL)
+ return false; /* libpq failure, probably lost connection */
if (strcmp(severity, "FATAL") == 0)
return false;
if (strcmp(severity, "PANIC") == 0)
[parent: a5dbca460ace]