!2058 修复group by负数的core问题
Merge pull request !2058 from pengjiong/array
This commit is contained in:
@ -4681,7 +4681,7 @@ static void transformGroupConstToColumn(ParseState* pstate, Node* groupClause, L
|
||||
}
|
||||
|
||||
long target_pos = intVal(val);
|
||||
if (target_pos <= list_length(targetList)) {
|
||||
if (target_pos > 0 && target_pos <= list_length(targetList)) {
|
||||
TargetEntry* tle = (TargetEntry*)list_nth(targetList, target_pos - 1);
|
||||
lfirst(lc) = copyObject(tle->expr);
|
||||
|
||||
|
@ -457,6 +457,11 @@ select count(*) from (select distinct(c*d) from t_agg1);
|
||||
343
|
||||
(1 row)
|
||||
|
||||
-- group by with negative value
|
||||
SELECT ( 'x' , 'x' ) x GROUP BY -128 , ( );
|
||||
ERROR: GROUP BY position -128 is not in select list
|
||||
LINE 1: SELECT ( 'x' , 'x' ) x GROUP BY -128 , ( );
|
||||
^
|
||||
reset current_schema;
|
||||
drop schema if exists distribute_aggregates_part2 cascade;
|
||||
NOTICE: drop cascades to 3 other objects
|
||||
|
@ -76,5 +76,8 @@ select count(*) from (select distinct(c) from t_agg1);
|
||||
explain (costs off) select count(*) from (select distinct(c*d) from t_agg1);
|
||||
select count(*) from (select distinct(c*d) from t_agg1);
|
||||
|
||||
-- group by with negative value
|
||||
SELECT ( 'x' , 'x' ) x GROUP BY -128 , ( );
|
||||
|
||||
reset current_schema;
|
||||
drop schema if exists distribute_aggregates_part2 cascade;
|
||||
|
Reference in New Issue
Block a user