mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for bug #1335: filesort is missing in EXPLAIN if ORDER BY NULL is used
mysql-test/r/group_by.result: test results fixed mysql-test/t/group_by.test: added few explicit tests for bug #1335
This commit is contained in:
@ -696,8 +696,18 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
||||
|
||||
if (select_options & SELECT_DESCRIBE)
|
||||
{
|
||||
if (!order && !no_order)
|
||||
order=group;
|
||||
/*
|
||||
Check if we managed to optimize ORDER BY away and don't use temporary
|
||||
table to resolve ORDER BY: in that case, we only may need to do
|
||||
filesort for GROUP BY.
|
||||
*/
|
||||
if (!order && !no_order && (!skip_sort_order || !need_tmp))
|
||||
{
|
||||
/* Reset 'order' to 'group' and reinit variables describing 'order' */
|
||||
order= group;
|
||||
simple_order= simple_group;
|
||||
skip_sort_order= 0;
|
||||
}
|
||||
if (order &&
|
||||
(join.const_tables == join.tables ||
|
||||
((simple_order || skip_sort_order) &&
|
||||
|
Reference in New Issue
Block a user