git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d157e7)
Don't fail on libpq-generated error reports in pg_amcheck.
Mon, 6 Jun 2022 15:26:57 +0000 (11:26 -0400)
Mon, 6 Jun 2022 15:26:57 +0000 (11:26 -0400)
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.


diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index f0b818e987ae33ac90043ee964048eb1fed92d74..3cff319f0257987b9b9c180681ecfa4679f2efef 100644 (file)
--- 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)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /