On Fri, 2 Jul 2021 at 22:55, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote: > Here's an update with the > last set of changes discussed. If you allow me a small suggestion. Move the initializations of the variable tmp_var to after check if the function can run. Saves some cycles, when not running.
/* Ensure we disallow calling when not in aggregate context */ if (!AggCheckCallContext(fcinfo, NULL)) elog(ERROR, "aggregate function called in non-aggregate context"); + init_var(&tmp_var); + regards, Ranier Vilela