* AggRegisterCallback - register a cleanup callback for an aggregate * * This is useful for aggs to register shutdown callbacks, which will ensure * that non-memory resources are freed. The callback will occur just before * the associated aggcontext (as returned by AggCheckCallContext) is reset, * either between groups or as a result of rescanning the query. The callback * will NOT be call
| 5035 | * As above, this is currently not useful for aggs called as window functions. |
| 5036 | */ |
| 5037 | void |
| 5038 | AggRegisterCallback(FunctionCallInfo fcinfo, |
| 5039 | ExprContextCallbackFunction func, |
| 5040 | Datum arg) |
| 5041 | { |
| 5042 | if (fcinfo->context && IsA(fcinfo->context, AggState)) |
| 5043 | { |
| 5044 | AggState *aggstate = (AggState *) fcinfo->context; |
| 5045 | ExprContext *cxt = aggstate->curaggcontext; |
| 5046 | |
| 5047 | RegisterExprContextCallback(cxt, func, arg); |
| 5048 | |
| 5049 | return; |
| 5050 | } |
| 5051 | elog(ERROR, "aggregate function cannot register a callback in this context"); |
| 5052 | } |
| 5053 | |
| 5054 | |
| 5055 | /* ---------------------------------------------------------------- |
no test coverage detected