mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Manual merge from mysql-trunk-merge.
Conflicts: - storage/myisam/mi_packrec.c
This commit is contained in:
@@ -7235,7 +7235,19 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
|
||||
for (order=first_order; order ; order=order->next)
|
||||
{
|
||||
table_map order_tables=order->item[0]->used_tables();
|
||||
if (order->item[0]->with_sum_func)
|
||||
if (order->item[0]->with_sum_func ||
|
||||
/*
|
||||
If the outer table of an outer join is const (either by itself or
|
||||
after applying WHERE condition), grouping on a field from such a
|
||||
table will be optimized away and filesort without temporary table
|
||||
will be used unless we prevent that now. Filesort is not fit to
|
||||
handle joins and the join condition is not applied. We can't detect
|
||||
the case without an expensive test, however, so we force temporary
|
||||
table for all queries containing more than one table, ROLLUP, and an
|
||||
outer join.
|
||||
*/
|
||||
(join->tables > 1 && join->rollup.state == ROLLUP::STATE_INITED &&
|
||||
join->outer_join))
|
||||
*simple_order=0; // Must do a temp table to sort
|
||||
else if (!(order_tables & not_const_tables))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user