diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4cb99a04c02..cc3ff1037ad 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1570,7 +1570,6 @@ JOIN::optimize_inner() DBUG_RETURN(1); /* purecov: inspected */ /* dump_TABLE_LIST_graph(select_lex, select_lex->leaf_tables); */ select_lex->update_used_tables(); - } eval_select_list_used_tables(); @@ -1640,6 +1639,8 @@ JOIN::optimize_inner() sel->where= conds; + select_lex->update_used_tables(); + if (arena) thd->restore_active_arena(arena, &backup); } @@ -13664,6 +13665,9 @@ static bool check_simple_equality(THD *thd, const Item::Context &ctx, { if (((Item_ref*)left_item)->get_depended_from()) return FALSE; + if (((Item_direct_view_ref*)left_item)->get_null_ref_table() != + NO_NULL_TABLE && !left_item->real_item()->used_tables()) + return FALSE; left_item= left_item->real_item(); } if (right_item->type() == Item::REF_ITEM && @@ -13671,6 +13675,9 @@ static bool check_simple_equality(THD *thd, const Item::Context &ctx, { if (((Item_ref*)right_item)->get_depended_from()) return FALSE; + if (((Item_direct_view_ref*)right_item)->get_null_ref_table() != + NO_NULL_TABLE && !right_item->real_item()->used_tables()) + return FALSE; right_item= right_item->real_item(); } if (left_item->type() == Item::FIELD_ITEM && |