mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#27219: Aggregate functions in ORDER BY.
Mixing aggregate functions and non-grouping columns is not allowed in the ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because of insufficient check. In order to check more thoroughly the new algorithm employs a list of outer fields used in a sum function and a SELECT_LEX::full_group_by_flag. Each non-outer field checked to find out whether it's aggregated or not and the current select is marked accordingly. All outer fields that are used under an aggregate function are added to the Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func function.
This commit is contained in:
@ -1253,6 +1253,7 @@ void st_select_lex::init_select()
|
||||
non_agg_fields.empty();
|
||||
cond_value= having_value= Item::COND_UNDEF;
|
||||
inner_refs_list.empty();
|
||||
full_group_by_flag= 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1491,8 +1492,6 @@ bool st_select_lex::test_limit()
|
||||
"LIMIT & IN/ALL/ANY/SOME subquery");
|
||||
return(1);
|
||||
}
|
||||
// no sense in ORDER BY without LIMIT
|
||||
order_list.empty();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user