* deallocate_query * Deallocate a prepared statement for a foreign insert/update/delete * operation */
| 4392 | * operation |
| 4393 | */ |
| 4394 | static void |
| 4395 | deallocate_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 |
no test coverage detected