mirror of
https://github.com/MariaDB/server.git
synced 2026-04-28 11:15:33 +02:00
Fixed the bug mdev-7599.
At some conditions the function opt_sum_query() can apply MIN/MAX optimizations to to Item_sum objects of a select These optimizations becomes invalid if this select is the subquery of an IN subquery predicate that is converted to a EXISTS subquery. Thus in this case the MIX/MAX optimizations that have been applied in opt_sum_query() must be rolled back. This bug appeared in 5.3 when the code for the cost base choice between materialization and in-to-exists transformation of non-correlated IN subqueries was introduced. Before this code in-to-exists transformations were always performed before the call of opt_sum_query().
This commit is contained in:
parent
9495e018fb
commit
e0352fb079
7 changed files with 124 additions and 0 deletions
|
|
@ -253,6 +253,8 @@ int opt_sum_query(THD *thd,
|
|||
int error= 0;
|
||||
DBUG_ENTER("opt_sum_query");
|
||||
|
||||
thd->lex->current_select->min_max_opt_list.empty();
|
||||
|
||||
if (conds)
|
||||
where_tables= conds->used_tables();
|
||||
|
||||
|
|
@ -444,7 +446,14 @@ int opt_sum_query(THD *thd,
|
|||
item_sum->aggregator_clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
item_sum->reset_and_add();
|
||||
/*
|
||||
Save a reference to the item for possible rollback
|
||||
of the min/max optimizations for this select
|
||||
*/
|
||||
thd->lex->current_select->min_max_opt_list.push_back(item_sum);
|
||||
}
|
||||
item_sum->make_const();
|
||||
recalc_const_item= 1;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue