diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 99a44115df4..6b274751ba7 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -1014,6 +1014,7 @@ finalize_partialaggregate(AggState *aggstate, pergroupstate->transValueIsNull, pertrans->transtypeLen); fcinfo->argnull[0] = pergroupstate->transValueIsNull; + fcinfo->isnull = false; *resultVal = FunctionCallInvoke(fcinfo); *resultIsNull = fcinfo->isnull; diff --git a/src/include/fmgr.h b/src/include/fmgr.h index 101f513ba67..aa7fb79f7bd 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -138,6 +138,11 @@ extern void fmgr_symbol(Oid functionId, char **mod, char **fn); * caller must still check fcinfo->isnull! Also, if function is strict, * it is caller's responsibility to verify that no null arguments are present * before calling. + * + * Some code performs multiple calls without redoing InitFunctionCallInfoData, + * possibly altering the argument values. This is okay, but be sure to reset + * the fcinfo->isnull flag before each call, since callees are permitted to + * assume that starts out false. */ #define FunctionCallInvoke(fcinfo) ((* (fcinfo)->flinfo->fn_addr) (fcinfo))