* TableCommandResultHandler * * ParallelSlotResultHandler for results of commands (not queries) against * tables. * * Requires that the result status is either PGRES_COMMAND_OK or an error about * a missing table. This is useful for utilities that compile a list of tables * to process and then run commands (vacuum, reindex, or whatever) against * those tables, as there is a race condition
| 506 | * context: unused |
| 507 | */ |
| 508 | bool |
| 509 | TableCommandResultHandler(PGresult *res, PGconn *conn, void *context) |
| 510 | { |
| 511 | Assert(res != NULL); |
| 512 | Assert(conn != NULL); |
| 513 | |
| 514 | /* |
| 515 | * If it's an error, report it. Errors about a missing table are harmless |
| 516 | * so we continue processing; but die for other errors. |
| 517 | */ |
| 518 | if (PQresultStatus(res) != PGRES_COMMAND_OK) |
| 519 | { |
| 520 | char *sqlState = PQresultErrorField(res, PG_DIAG_SQLSTATE); |
| 521 | |
| 522 | pg_log_error("processing of database \"%s\" failed: %s", |
| 523 | PQdb(conn), PQerrorMessage(conn)); |
| 524 | |
| 525 | if (sqlState && strcmp(sqlState, ERRCODE_UNDEFINED_TABLE) != 0) |
| 526 | { |
| 527 | PQclear(res); |
| 528 | return false; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | return true; |
| 533 | } |
nothing calls this directly
no test coverage detected