Commit 4d070fd9 authored by timour@mysql.com's avatar timour@mysql.com

Fix for Bug#3759

The cause of the bug is that Item_func_in::fix_fields did not fully update its
used_table_cache. This was the cause for not_null_tables in setup_conds() to be
still 0 after the call
  not_null_tables= (*conds)->not_null_tables();
As a result the condition in setup_conds()
  if ( ... (table->table->map & not_null_tables) ...)
failed, which was the cause for the ON expression not to be added to conds, and later
the optimizer couldn't detect that it could apply the OUTER JOIN ==> JOIN optimization.
parent 079678be
...@@ -136,6 +136,7 @@ tim@sand.box ...@@ -136,6 +136,7 @@ tim@sand.box
tim@threads.polyesthetic.msg tim@threads.polyesthetic.msg
tim@white.box tim@white.box
tim@work.mysql.com tim@work.mysql.com
timour@mysql.com
tom@basil-firewall.home.com tom@basil-firewall.home.com
tonu@hundin.mysql.fi tonu@hundin.mysql.fi
tonu@volk.internalnet tonu@volk.internalnet
......
...@@ -431,6 +431,9 @@ class Item_func_in :public Item_int_func ...@@ -431,6 +431,9 @@ class Item_func_in :public Item_int_func
{ {
bool res= (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist)); bool res= (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist));
with_sum_func= with_sum_func || item->with_sum_func; with_sum_func= with_sum_func || item->with_sum_func;
used_tables_cache|= item->used_tables();
not_null_tables_cache|= item->not_null_tables();
const_item_cache&= item->const_item();
return res; return res;
} }
void fix_length_and_dec(); void fix_length_and_dec();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment