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

@ -474,6 +474,7 @@ static void advance_transition_function(
*fcinfo, &(peraggstate->transfn), numTransInputs + 1, peraggstate->aggCollation, (Node*)aggstate, NULL);
fcinfo->arg[0] = pergroupstate->transValue;
fcinfo->argnull[0] = pergroupstate->transValueIsNull;
fcinfo->argTypes[0] = InvalidOid;
fcinfo->isnull = false; /* just in case transfn doesn't set it */
Node *origin_fcxt = fcinfo->context;
@ -577,6 +578,7 @@ static void advance_collection_function(
InitFunctionCallInfoData(*fcinfo, &(peraggstate->collectfn), 2, peraggstate->aggCollation, (Node*)aggstate, NULL);
fcinfo->arg[0] = pergroupstate->collectValue;
fcinfo->argnull[0] = pergroupstate->collectValueIsNull;
fcinfo->argTypes[0] = InvalidOid;
newVal = FunctionCallInvoke(fcinfo);
/*
@ -665,6 +667,7 @@ static void advance_aggregates(AggState* aggstate, AggStatePerGroup pergroup)
for (i = 0; i < numTransInputs; i++) {
fcinfo.arg[i + 1] = slot->tts_values[i];
fcinfo.argnull[i + 1] = slot->tts_isnull[i];
fcinfo.argTypes[i + 1] = InvalidOid;
}
for (setno = 0; setno < numGroupingSets; setno++) {
AggStatePerGroup pergroupstate = &pergroup[aggno + (setno * numAggs)];
@ -896,6 +899,7 @@ static void finalize_aggregate(AggState* aggstate, AggStatePerAgg peraggstate, A
foreach (lc, peraggstate->aggrefstate->aggdirectargs) {
fcinfo.arg[args_pos] =
ExecEvalExpr((ExprState*)lfirst(lc), aggstate->ss.ps.ps_ExprContext, &fcinfo.argnull[args_pos], NULL);
fcinfo.argTypes[args_pos] = ((ExprState*)lfirst(lc))->resultType;
if (anynull == true || fcinfo.argnull[args_pos] == true)
anynull = true;
else
@ -928,6 +932,7 @@ static void finalize_aggregate(AggState* aggstate, AggStatePerAgg peraggstate, A
fcinfo, &(peraggstate->finalfn), numFinalArgs, peraggstate->aggCollation, (Node*)aggstate, NULL);
fcinfo.arg[0] = pergroupstate->transValue;
fcinfo.argnull[0] = pergroupstate->transValueIsNull;
fcinfo.argTypes[0] = InvalidOid;
if (anynull == true || pergroupstate->transValueIsNull == true)
anynull = true;
else
@ -936,6 +941,7 @@ static void finalize_aggregate(AggState* aggstate, AggStatePerAgg peraggstate, A
while (args_pos < numFinalArgs) {
fcinfo.arg[args_pos] = (Datum)0;
fcinfo.argnull[args_pos] = true;
fcinfo.argTypes[args_pos] = InvalidOid;
args_pos++;
anynull = true;
}