mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
Functions over sum functions wasn't set up correctly for the ORDER BY clause which leads to a wrong order of the result set. The split_sum_func() function is called now for each ORDER BY item that contains a sum function to set it up correctly.
This commit is contained in:
@ -455,6 +455,17 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
|
||||
select_lex->fix_prepare_information(thd, &conds, &having);
|
||||
|
||||
if (order)
|
||||
{
|
||||
ORDER *ord;
|
||||
for (ord= order; ord; ord= ord->next)
|
||||
{
|
||||
Item *item= *ord->item;
|
||||
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
|
||||
item->split_sum_func(thd, ref_pointer_array, all_fields);
|
||||
}
|
||||
}
|
||||
|
||||
if (having && having->with_sum_func)
|
||||
having->split_sum_func2(thd, ref_pointer_array, all_fields,
|
||||
&having, TRUE);
|
||||
|
Reference in New Issue
Block a user