• evgen@moonbone.local's avatar
    Fixed bug#20503: Server crash due to the ORDER clause not taken into account · e0461067
    evgen@moonbone.local authored
    while space allocation
    
    Under some circumstances DISTINCT clause can be converted to grouping.
    In such cases grouping is performed by all items in the select list.
    If an ORDER clause is present then items from it is prepended to group list.
    But the case with ORDER wasn't taken into account when allocating the
    array for sum functions. This leads to memory corruption and crash.
    
    The JOIN::alloc_func_list() function now allocates additional space if there
    is an ORDER by clause is specified and DISTINCT -> GROUP BY optimization is
    possible.
    e0461067
select.test 151 KB