diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index 90ab78cec0a..a016f04953c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5531,13 +5531,11 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) */ Name_resolution_context *last_checked_context= context; Item **ref= (Item **) not_found_item; - SELECT_LEX *current_sel= thd->lex->current_select; + SELECT_LEX *current_sel= context->select_lex; Name_resolution_context *outer_context= 0; SELECT_LEX *select= 0; - /* Currently derived tables cannot be correlated */ - if ((current_sel->master_unit()->first_select()->get_linkage() != - DERIVED_TABLE_TYPE) && - current_sel->master_unit()->outer_select()) + + if (current_sel->master_unit()->outer_select()) outer_context= context->outer_context; /* @@ -5870,7 +5868,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference) DBUG_ASSERT(fixed() == 0); Field *from_field= (Field *)not_found_field; bool outer_fixed= false; - SELECT_LEX *select= thd->lex->current_select; + SELECT_LEX *select= context->select_lex; if (select && select->in_tvc) { |