diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-06-06 11:26:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-06-06 11:26:57 -0400 |
commit | 51da231597a9e414174cf621b219559e18269dc3 (patch) | |
tree | 823836f62bae8b7852fafe274559825b76372370 | |
parent | 6d157e7cb8d3f4aa28a9fef95c498ce8ac3c31a9 (diff) | |
download | postgresql-51da231597a9e414174cf621b219559e18269dc3.tar.gz postgresql-51da231597a9e414174cf621b219559e18269dc3.zip |
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.
-rw-r--r-- | src/bin/pg_amcheck/pg_amcheck.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c index f0b818e987a..3cff319f025 100644 --- a/src/bin/pg_amcheck/pg_amcheck.c +++ b/src/bin/pg_amcheck/pg_amcheck.c @@ -930,6 +930,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) |