* plpgsql_xact_cb --- post-transaction-commit-or-abort cleanup * * If a simple-expression EState was created in the current transaction, * it has to be cleaned up. The same for the simple-expression resowner. */
| 8326 | * it has to be cleaned up. The same for the simple-expression resowner. |
| 8327 | */ |
| 8328 | void |
| 8329 | plpgsql_xact_cb(XactEvent event, void *arg) |
| 8330 | { |
| 8331 | /* |
| 8332 | * If we are doing a clean transaction shutdown, free the EState and tell |
| 8333 | * the resowner to release whatever plancache references it has, so that |
| 8334 | * all remaining resources will be released correctly. (We don't need to |
| 8335 | * actually delete the resowner here; deletion of the |
| 8336 | * TopTransactionResourceOwner will take care of that.) |
| 8337 | * |
| 8338 | * In an abort, we expect the regular abort recovery procedures to release |
| 8339 | * everything of interest, so just clear our pointers. |
| 8340 | */ |
| 8341 | if (event == XACT_EVENT_COMMIT || |
| 8342 | event == XACT_EVENT_PARALLEL_COMMIT || |
| 8343 | event == XACT_EVENT_PREPARE) |
| 8344 | { |
| 8345 | simple_econtext_stack = NULL; |
| 8346 | |
| 8347 | if (shared_simple_eval_estate) |
| 8348 | FreeExecutorState(shared_simple_eval_estate); |
| 8349 | shared_simple_eval_estate = NULL; |
| 8350 | if (shared_simple_eval_resowner) |
| 8351 | ResourceOwnerReleaseAllPlanCacheRefs(shared_simple_eval_resowner); |
| 8352 | shared_simple_eval_resowner = NULL; |
| 8353 | } |
| 8354 | else if (event == XACT_EVENT_ABORT || |
| 8355 | event == XACT_EVENT_PARALLEL_ABORT) |
| 8356 | { |
| 8357 | simple_econtext_stack = NULL; |
| 8358 | shared_simple_eval_estate = NULL; |
| 8359 | shared_simple_eval_resowner = NULL; |
| 8360 | } |
| 8361 | } |
| 8362 | |
| 8363 | /* |
| 8364 | * plpgsql_subxact_cb --- post-subtransaction-commit-or-abort cleanup |
nothing calls this directly
no test coverage detected