diff options
Diffstat (limited to 'sql/opt_table_elimination.cc')
-rw-r--r-- | sql/opt_table_elimination.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 9ab6e0e84d2..3de73c3d4cc 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -587,10 +587,8 @@ void eliminate_tables(JOIN *join) if (!join->outer_join) DBUG_VOID_RETURN; -#ifndef DBUG_OFF if (!optimizer_flag(thd, OPTIMIZER_SWITCH_TABLE_ELIMINATION)) DBUG_VOID_RETURN; /* purecov: inspected */ -#endif /* Find the tables that are referred to from WHERE/HAVING */ used_tables= (join->conds? join->conds->used_tables() : 0) | @@ -694,6 +692,8 @@ eliminate_tables_for_list(JOIN *join, List<TABLE_LIST> *join_list, { table_map outside_used_tables= tables_used_elsewhere | tables_used_on_left; + if (on_expr) + outside_used_tables |= on_expr->used_tables(); if (tbl->nested_join) { /* This is "... LEFT JOIN (join_nest) ON cond" */ |