Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 51da231

Browse files
committed
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 6d157e7's mistake was repeated elsewhere.
1 parent 6d157e7 commit 51da231

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bin/pg_amcheck/pg_amcheck.c

+2
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ should_processing_continue(PGresult *res)
930930
/* This is expected but requires closer scrutiny */
931931
case PGRES_FATAL_ERROR:
932932
severity = PQresultErrorField(res, PG_DIAG_SEVERITY_NONLOCALIZED);
933+
if (severity == NULL)
934+
return false; /* libpq failure, probably lost connection */
933935
if (strcmp(severity, "FATAL") == 0)
934936
return false;
935937
if (strcmp(severity, "PANIC") == 0)

0 commit comments

Comments
 (0)