mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +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:
@ -611,7 +611,16 @@ public:
|
||||
joins on the right.
|
||||
*/
|
||||
List<String> *prev_join_using;
|
||||
|
||||
/*
|
||||
Bitmap used in the ONLY_FULL_GROUP_BY_MODE to prevent mixture of aggregate
|
||||
functions and non aggregated fields when GROUP BY list is absent.
|
||||
Bits:
|
||||
0 - non aggregated fields are used in this select,
|
||||
defined as NON_AGG_FIELD_USED.
|
||||
1 - aggregate functions are used in this select,
|
||||
defined as SUM_FUNC_USED.
|
||||
*/
|
||||
uint8 full_group_by_flag;
|
||||
void init_query();
|
||||
void init_select();
|
||||
st_select_lex_unit* master_unit();
|
||||
|
Reference in New Issue
Block a user