summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2008-05-16 17:05:55 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2008-05-16 17:05:55 +0300
commit0fb1527e9556940d30ab14b11742c03510db081d (patch)
treefa9c710bb7a7cf881050ea378fbd7bf5e1c32e83 /sql/sql_select.cc
parent21c07eb7b5f970d10aa2ce961a901ba78358125e (diff)
downloadmariadb-git-0fb1527e9556940d30ab14b11742c03510db081d.tar.gz
Bug #36011: server crash with explain extended on query
with dependent subqueries An IN subquery is executed on EXPLAIN when it's not correlated. If the subquery required a temporary table for its execution not all the internal structures were restored from pointing to the items of the temporary table to point back to the items of the subquery. Fixed by restoring the ref array when a temp tables were used in executing the IN subquery during EXPLAIN EXTENDED. mysql-test/r/subselect.result: Bug #36011: test case mysql-test/t/subselect.test: Bug #36011: test case sql/sql_select.cc: Bug #36011: restore the ref array after execution when there were temp tables.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 11062998e6a..d1e5837329b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2104,11 +2104,12 @@ JOIN::exec()
/*
With EXPLAIN EXTENDED we have to restore original ref_array
for a derived table which is always materialized.
- Otherwise we would not be able to print the query correctly.
+ We also need to do this when we have temp table(s).
+ Otherwise we would not be able to print the query correctly.
*/
- if (items0 &&
- (thd->lex->describe & DESCRIBE_EXTENDED) &&
- select_lex->linkage == DERIVED_TABLE_TYPE)
+ if (items0 && (thd->lex->describe & DESCRIBE_EXTENDED) &&
+ (select_lex->linkage == DERIVED_TABLE_TYPE ||
+ exec_tmp_table1 || exec_tmp_table2))
set_items_ref_array(items0);
DBUG_VOID_RETURN;