diff options
author | evgen@moonbone.local <> | 2008-03-27 19:49:32 +0300 |
---|---|---|
committer | evgen@moonbone.local <> | 2008-03-27 19:49:32 +0300 |
commit | 21c6145a6e70c06b36f55929223dc84edab952bf (patch) | |
tree | ca14d8fab0a56e30909c86fffffee0bc6e79fb83 /sql/sql_lex.cc | |
parent | 3a87bbfe42f23c562a37d63b4203dc24ed464632 (diff) | |
download | mariadb-git-21c6145a6e70c06b36f55929223dc84edab952bf.tar.gz |
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.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index f1b4ffc949d..6bfcd982b04 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -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); } |