MCPcopy Create free account
hub / github.com/apache/cloudberry / TableCommandResultHandler

Function TableCommandResultHandler

src/fe_utils/parallel_slot.c:508–533  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

506 * context: unused
507 */
508bool
509TableCommandResultHandler(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}

Callers

nothing calls this directly

Calls 5

PQresultStatusFunction · 0.85
PQresultErrorFieldFunction · 0.85
PQdbFunction · 0.85
PQerrorMessageFunction · 0.85
PQclearFunction · 0.85

Tested by

no test coverage detected