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

Function RegisterExprContextCallback

src/backend/executor/execUtils.c:982–1000  ·  view source on GitHub ↗

* Register a shutdown callback in an ExprContext. * * Shutdown callbacks will be called (in reverse order of registration) * when the ExprContext is deleted or rescanned. This provides a hook * for functions called in the context to do any cleanup needed --- it's * particularly useful for functions returning sets. Note that the * callback will *not* be called in the event that execution is

Source from the content-addressed store, hash-verified

980 * by an error.
981 */
982void
983RegisterExprContextCallback(ExprContext *econtext,
984 ExprContextCallbackFunction function,
985 Datum arg)
986{
987 ExprContext_CB *ecxt_callback;
988
989 /* Save the info in appropriate memory context */
990 ecxt_callback = (ExprContext_CB *)
991 MemoryContextAlloc(econtext->ecxt_per_query_memory,
992 sizeof(ExprContext_CB));
993
994 ecxt_callback->function = function;
995 ecxt_callback->arg = arg;
996
997 /* link to front of list for appropriate execution order */
998 ecxt_callback->next = econtext->ecxt_callbacks;
999 econtext->ecxt_callbacks = ecxt_callback;
1000}
1001
1002/*
1003 * Deregister a shutdown callback in an ExprContext.

Callers 5

init_MultiFuncCallFunction · 0.85
fmgr_sqlFunction · 0.85
AggRegisterCallbackFunction · 0.85

Calls 1

MemoryContextAllocFunction · 0.85

Tested by

no test coverage detected