mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed bug in MAX() optimization when used with JOIN and ON expressions
This commit is contained in:
@ -37,6 +37,19 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
bool recalc_const_item=0;
|
||||
table_map removed_tables=0;
|
||||
Item *item;
|
||||
COND *org_conds= conds;
|
||||
|
||||
/* Add all ON conditions to WHERE condition */
|
||||
for (TABLE_LIST *tl=tables; tl ; tl= tl->next)
|
||||
{
|
||||
if (tl->on_expr)
|
||||
conds= and_expressions(conds, tl->on_expr, &org_conds);
|
||||
}
|
||||
|
||||
/*
|
||||
Iterate through item is select part and replace COUNT(), MIN() and MAX()
|
||||
with constants (if possible)
|
||||
*/
|
||||
|
||||
while ((item= it++))
|
||||
{
|
||||
|
Reference in New Issue
Block a user