Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc080b22

Browse files
committed
Fix minor oversights in nodeAgg.c.
aggstate->evalproj is always set up by ExecInitAgg, so there's noneed to test. Doing so led Coverity to think that we might beintending "slot" to be possibly NULL here, and it quite properlycomplained that the rest of combine_aggregates() wasn't preparedfor that.Also fix a couple of obvious thinkos in Asserts checking that"inputoff" isn't past the end of the slot.Errors introduced in commit8ed3f11, so no need for back-patch.
1 parent7d41a2b commitc080b22

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎src/backend/executor/nodeAgg.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ advance_aggregates(AggState *aggstate, AggStatePerGroup pergroup)
932932

933933
/* Load values into fcinfo */
934934
/* Start from 1, since the 0th arg will be the transition value */
935-
Assert(slot->tts_nvalid >=numTransInputs);
935+
Assert(slot->tts_nvalid >= (numTransInputs+inputoff));
936+
936937
for (i=0;i<numTransInputs;i++)
937938
{
938939
fcinfo->arg[i+1]=slot->tts_values[i+inputoff];
@@ -963,14 +964,13 @@ combine_aggregates(AggState *aggstate, AggStatePerGroup pergroup)
963964
{
964965
inttransno;
965966
intnumTrans=aggstate->numtrans;
966-
TupleTableSlot*slot=NULL;
967+
TupleTableSlot*slot;
967968

968969
/* combine not supported with grouping sets */
969970
Assert(aggstate->phase->numsets==0);
970971

971972
/* compute input for all aggregates */
972-
if (aggstate->evalproj)
973-
slot=ExecProject(aggstate->evalproj,NULL);
973+
slot=ExecProject(aggstate->evalproj,NULL);
974974

975975
for (transno=0;transno<numTrans;transno++)
976976
{
@@ -979,8 +979,7 @@ combine_aggregates(AggState *aggstate, AggStatePerGroup pergroup)
979979
FunctionCallInfofcinfo=&pertrans->transfn_fcinfo;
980980
intinputoff=pertrans->inputoff;
981981

982-
Assert(slot->tts_nvalid >=1);
983-
Assert(slot->tts_nvalid+inputoff >=1);
982+
Assert(slot->tts_nvalid>inputoff);
984983

985984
/*
986985
* deserialfn_oid will be set if we must deserialize the input state

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp