• evgen@moonbone.local's avatar
    Bug#27219: Aggregate functions in ORDER BY. · 21c6145a
    evgen@moonbone.local authored
    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.
    21c6145a
sql_lex.cc 66.4 KB