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

Function deallocate_query

contrib/postgres_fdw/postgres_fdw.c:4394–4416  ·  view source on GitHub ↗

* deallocate_query * Deallocate a prepared statement for a foreign insert/update/delete * operation */

Source from the content-addressed store, hash-verified

4392 * operation
4393 */
4394static void
4395deallocate_query(PgFdwModifyState *fmstate)
4396{
4397 char sql[64];
4398 PGresult *res;
4399
4400 /* do nothing if the query is not allocated */
4401 if (!fmstate->p_name)
4402 return;
4403
4404 snprintf(sql, sizeof(sql), "DEALLOCATE %s", fmstate->p_name);
4405
4406 /*
4407 * We don't use a PG_TRY block here, so be careful not to throw error
4408 * without releasing the PGresult.
4409 */
4410 res = pgfdw_exec_query(fmstate->conn, sql, fmstate->conn_state);
4411 if (PQresultStatus(res) != PGRES_COMMAND_OK)
4412 pgfdw_report_error(ERROR, res, fmstate->conn, true, sql);
4413 PQclear(res);
4414 pfree(fmstate->p_name);
4415 fmstate->p_name = NULL;
4416}
4417
4418/*
4419 * build_remote_returning

Callers 2

execute_foreign_modifyFunction · 0.85
finish_foreign_modifyFunction · 0.85

Calls 5

pgfdw_exec_queryFunction · 0.85
PQresultStatusFunction · 0.85
pgfdw_report_errorFunction · 0.85
PQclearFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected