1
0
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:
monty@hundin.mysql.fi
2002-11-09 09:51:03 +02:00
parent 0f14b3c27b
commit e08ed8a582
5 changed files with 131 additions and 2 deletions

View File

@ -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++))
{