Commit 32a85ee4 authored by Tom Lane's avatar Tom Lane

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.
parent a5dbca46
...@@ -958,6 +958,8 @@ should_processing_continue(PGresult *res) ...@@ -958,6 +958,8 @@ should_processing_continue(PGresult *res)
/* This is expected but requires closer scrutiny */ /* This is expected but requires closer scrutiny */
case PGRES_FATAL_ERROR: case PGRES_FATAL_ERROR:
severity = PQresultErrorField(res, PG_DIAG_SEVERITY_NONLOCALIZED); severity = PQresultErrorField(res, PG_DIAG_SEVERITY_NONLOCALIZED);
if (severity == NULL)
return false; /* libpq failure, probably lost connection */
if (strcmp(severity, "FATAL") == 0) if (strcmp(severity, "FATAL") == 0)
return false; return false;
if (strcmp(severity, "PANIC") == 0) if (strcmp(severity, "PANIC") == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment