Skip to content

Commit 0abc068

Browse files
committed
MB-31018 Return error message when aggregate arguments contain letting variables and group by alias
Change-Id: I6612084db68203c86762cbc2978d6815fb6b8e52 Reviewed-on: http://review.couchbase.org/98780 Reviewed-by: Bingjie Miao <[email protected]> Tested-by: Chang Liu <[email protected]>
1 parent 9bac49a commit 0abc068

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

planner/build_select_sub.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ func allAggregates(node *algebra.Subselect, order *algebra.Order) (algebra.Aggre
543543
if len(subAggs) > 0 {
544544
return nil, fmt.Errorf("Nested aggregates are not allowed.")
545545
}
546+
if group != nil && group.Letting() != nil && dependsOnLet(agg.Operand(), group.Letting()) {
547+
return nil, fmt.Errorf("Aggregate can't depend on GROUP alias or LETTING variable.")
548+
}
546549
}
547550
}
548551

0 commit comments

Comments
 (0)