diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-11-26 16:32:51 +0200 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-11-26 16:32:51 +0200 |
commit | 96d45ed2f64f83a53a4d9a4267cb93ea14c9f7ca (patch) | |
tree | 74a1415aa93abdbe676036e4386aadf2b13ea031 /sql/item_subselect.cc | |
parent | 7d27f9c0cace2adaaf95bfef456e2dd41a408e08 (diff) | |
parent | c5987223db0158389602e57c25c13368aad80b34 (diff) | |
download | mariadb-git-96d45ed2f64f83a53a4d9a4267cb93ea14c9f7ca.tar.gz |
merge
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 5cf585e1a56..c1b1f47e5e9 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1910,21 +1910,26 @@ int subselect_single_select_engine::exec() DBUG_RETURN(join->error ? join->error : 1); } if (!select_lex->uncacheable && thd->lex->describe && - !(join->select_options & SELECT_DESCRIBE) && - join->need_tmp) + !(join->select_options & SELECT_DESCRIBE)) { item->update_used_tables(); if (item->const_item()) { /* + It's necessary to keep original JOIN table because + create_sort_index() function may overwrite original + JOIN_TAB::type and wrong optimization method can be + selected on re-execution. + */ + select_lex->uncacheable|= UNCACHEABLE_EXPLAIN; + select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN; + /* Force join->join_tmp creation, because this subquery will be replaced by a simple select from the materialization temp table by optimize() called by EXPLAIN and we need to preserve the initial query structure so we can display it. */ - select_lex->uncacheable|= UNCACHEABLE_EXPLAIN; - select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN; - if (join->init_save_join_tab()) + if (join->need_tmp && join->init_save_join_tab()) DBUG_RETURN(1); /* purecov: inspected */ } } |