diff options
author | unknown <monty@hundin.mysql.fi> | 2002-11-09 09:51:03 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-11-09 09:51:03 +0200 |
commit | f9fde16a8ce40093a325132197182bb16d46be40 (patch) | |
tree | 50d75360317401d22dd6d4a2f7a6a240f5ef68b0 /sql/opt_sum.cc | |
parent | a1a6f4c11ff122c7ac170f4818dfd931f8abb7bf (diff) | |
download | mariadb-git-f9fde16a8ce40093a325132197182bb16d46be40.tar.gz |
Fixed bug in MAX() optimization when used with JOIN and ON expressions
sql/item_cmpfunc.cc:
Create an AND expression from two expressions
sql/item_cmpfunc.h:
Create an AND expression from two expressions
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 74e7b2ef3be..4b6a196051e 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -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++)) { |