deep copy procedure arg value

Offering: openGaussDev

More detail: deep copy procedure arg value

Match-id-dda612d112a2a69b554912340314383a39e71a7c
This commit is contained in:
openGaussDev
2022-03-03 21:30:19 +08:00
committed by yanghao
parent b93d4de9ed
commit 06c8f2afcf
5 changed files with 148 additions and 3 deletions

View File

@ -126,6 +126,7 @@ static void advance_windowaggregate(
ExprState* arg_state = (ExprState*)lfirst(arg);
fcinfo->arg[i] = ExecEvalExpr(arg_state, econtext, &fcinfo->argnull[i], NULL);
fcinfo->argTypes[i] = arg_state->resultType;
i++;
}
@ -176,6 +177,7 @@ static void advance_windowaggregate(
*fcinfo, &(peraggstate->transfn), num_arguments + 1, perfuncstate->winCollation, (Node*)winstate, NULL);
fcinfo->arg[0] = peraggstate->transValue;
fcinfo->argnull[0] = peraggstate->transValueIsNull;
fcinfo->argTypes[0] = InvalidOid;
new_val = FunctionCallInvoke(fcinfo);
/*
* If pass-by-ref datatype, must copy the new value into aggcontext and
@ -216,6 +218,7 @@ static void finalize_windowaggregate(WindowAggState* winstate, WindowStatePerFun
InitFunctionCallInfoData(fcinfo, &(peraggstate->finalfn), 1, perfuncstate->winCollation, (Node*)winstate, NULL);
fcinfo.arg[0] = peraggstate->transValue;
fcinfo.argnull[0] = peraggstate->transValueIsNull;
fcinfo.argTypes[0] = InvalidOid;
if (fcinfo.flinfo->fn_strict && peraggstate->transValueIsNull) {
/* don't call a strict function with NULL inputs */
*result = (Datum)0;