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

Function plpgsql_subxact_cb

src/pl/plpgsql/src/pl_exec.c:8370–8388  ·  view source on GitHub ↗

* plpgsql_subxact_cb --- post-subtransaction-commit-or-abort cleanup * * Make sure any simple-expression econtexts created in the current * subtransaction get cleaned up. We have to do this explicitly because * no other code knows which econtexts belong to which level of subxact. */

Source from the content-addressed store, hash-verified

8368 * no other code knows which econtexts belong to which level of subxact.
8369 */
8370void
8371plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid,
8372 SubTransactionId parentSubid, void *arg)
8373{
8374 if (event == SUBXACT_EVENT_COMMIT_SUB || event == SUBXACT_EVENT_ABORT_SUB)
8375 {
8376 while (simple_econtext_stack != NULL &&
8377 simple_econtext_stack->xact_subxid == mySubid)
8378 {
8379 SimpleEcontextStackEntry *next;
8380
8381 FreeExprContext(simple_econtext_stack->stack_econtext,
8382 (event == SUBXACT_EVENT_COMMIT_SUB));
8383 next = simple_econtext_stack->next;
8384 pfree(simple_econtext_stack);
8385 simple_econtext_stack = next;
8386 }
8387 }
8388}
8389
8390/*
8391 * assign_simple_var --- assign a new value to any VAR datum.

Callers 1

plpgsql_inline_handlerFunction · 0.85

Calls 2

FreeExprContextFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected