-
unknown authored
Non-correlated scalar subqueries may get executed in EXPLAIN at the optimization phase if they are part of a right hand sargable expression. If the scalar subquery uses a temp table to materialize its results it will replace the subquery structure from the parser with a simple select from the materialization table. As a result the EXPLAIN will crash as the temporary materialization table is not to be shown in EXPLAIN at all. Fixed by preserving the original query structure right after calling optimize() for scalar subqueries with temp tables executed during EXPLAIN. mysql-test/r/subselect.result: Bug #27807: test case mysql-test/t/subselect.test: Bug #27807: test case sql/item_subselect.cc: Bug #27807: preserve the join structure sql/sql_select.cc: Bug #27807: introduce initialization function for tmp_join sql/sql_select.h: Bug #27807: introduce initialization function for tmp_join
e5655cbe