修复聚合嵌套时的core问题
This commit is contained in:
@ -225,7 +225,8 @@ void transformAggregateCall(ParseState* pstate, Aggref* agg, List* args, List* a
|
||||
* didn't find any local vars or aggs.
|
||||
*/
|
||||
if (min_varlevel == 0) {
|
||||
if (pstate->p_hasAggs && checkExprHasAggs((Node*)agg->args)) {
|
||||
if (pstate->p_hasAggs &&
|
||||
(checkExprHasAggs((Node*)agg->args) || checkExprHasAggs((Node*)agg->aggdirectargs))) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_GROUPING_ERROR),
|
||||
errmsg("aggregate function calls cannot be nested"),
|
||||
|
||||
@ -579,6 +579,9 @@ GROUP BY c2,c3;
|
||||
----+----+----+------------
|
||||
(0 rows)
|
||||
|
||||
SELECT percentile_cont(sum(value)) WITHIN GROUP (ORDER BY value) FROM (VALUES ('2019-07-12 00:00:01'::timestamptz,'red',1),('2019-07-12 00:00:01'::timestamptz,'blue',2)) v(time,color,value);
|
||||
ERROR: aggregate function calls cannot be nested
|
||||
CONTEXT: referenced column: percentile_cont
|
||||
reset current_schema;
|
||||
drop schema if exists distribute_aggregates_part3 cascade;
|
||||
NOTICE: drop cascades to 2 other objects
|
||||
|
||||
@ -117,5 +117,7 @@ SELECT
|
||||
FROM sales_transaction_line
|
||||
GROUP BY c2,c3;
|
||||
|
||||
SELECT percentile_cont(sum(value)) WITHIN GROUP (ORDER BY value) FROM (VALUES ('2019-07-12 00:00:01'::timestamptz,'red',1),('2019-07-12 00:00:01'::timestamptz,'blue',2)) v(time,color,value);
|
||||
|
||||
reset current_schema;
|
||||
drop schema if exists distribute_aggregates_part3 cascade;
|
||||
|
||||
Reference in New Issue
Block a user