diff --git a/src/backend/distributed/planner/multi_logical_optimizer.c b/src/backend/distributed/planner/multi_logical_optimizer.c index f93312779..52db3da29 100644 --- a/src/backend/distributed/planner/multi_logical_optimizer.c +++ b/src/backend/distributed/planner/multi_logical_optimizer.c @@ -2896,7 +2896,9 @@ GetAggregateType(Oid aggFunctionId) } aggregateCount = lengthof(AggregateNames); - for (aggregateIndex = 0; aggregateIndex < aggregateCount; aggregateIndex++) + + Assert(AGGREGATE_INVALID_FIRST == 0); + for (aggregateIndex = 1; aggregateIndex < aggregateCount; aggregateIndex++) { const char *aggregateName = AggregateNames[aggregateIndex]; if (strncmp(aggregateName, aggregateProcName, NAMEDATALEN) == 0)