diff options
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 57dcbd4f540..1938db86743 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -854,7 +854,8 @@ void Item_subselect::fix_length_and_dec() table_map Item_subselect::used_tables() const { - return (table_map) ((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN)? + return (table_map) ((!forced_const && !const_item_cache && + (engine->uncacheable() & ~UNCACHEABLE_EXPLAIN))? used_tables_cache : 0L); } @@ -864,7 +865,7 @@ bool Item_subselect::const_item() const DBUG_ASSERT(thd); return (thd->lex->context_analysis_only ? FALSE : - forced_const || const_item_cache); + used_tables() == 0); } Item *Item_subselect::get_tmp_table_item(THD *thd_arg) |