Commit 536754c8 authored by Sergey Petrunya's avatar Sergey Petrunya

MWL#17: Table elimination

Fixes after post-review fixes:
- Don't search for tables in JOIN_TAB array. it's not initialized yet.
  use select_lex->leaf_tables instead.
parent b3f18c88
......@@ -676,16 +676,12 @@ Outer_join_dep *get_outer_join_dep(Table_elimination *te,
if (!(table_dep= te->table_deps[idx]))
{
TABLE *table= NULL;
/*
Locate and create the table. The search isnt very efficient but
typically we won't get here as we process the ON expression first
and that will create the Table_dep
*/
for (uint i= 0; i < te->join->tables; i++)
for (TABLE_LIST *tlist= te->join->select_lex->leaf_tables; tlist;
tlist=tlist->next_leaf)
{
if (te->join->join_tab[i].table->tablenr == (uint)idx)
if (tlist->table->tablenr == (uint)idx)
{
table= te->join->join_tab[i].table;
table=tlist->table;
break;
}
}
......
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