diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc index 1a86b8b3114..3dbe3badadf 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5493,8 +5493,9 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) 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) + if ((current_sel->master_unit()->first_select()->get_linkage() != + DERIVED_TABLE_TYPE) && + current_sel->master_unit()->outer_select()) outer_context= context->outer_context; /* |