summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_innodb.test
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-05-30 19:10:18 +0300
committerunknown <timour@askmonty.org>2012-05-30 19:10:18 +0300
commit66dfceb11fe2392c98ec0f481a01e8da7b4314b8 (patch)
tree94cb56bab195e2fa2a1e9786a0134f9b50260726 /mysql-test/t/subselect_innodb.test
parent662c51bad124b4290bcee52f049729c37e450858 (diff)
downloadmariadb-git-66dfceb11fe2392c98ec0f481a01e8da7b4314b8.tar.gz
Fix for bug lp:1006231
Analysis: When a subquery that needs a temp table is executed during the prepare or optimize phase of the outer query, at the end of the subquery execution all the JOIN_TABs of the subquery are replaced by a new JOIN_TAB that selects from the temp table. However that temp table has no corresponding TABLE_LIST. Once EXPLAIN execution reaches its last phase, it tries to print the names of the subquery tables through its TABLE_LISTs, but in the case of this bug there is no such TABLE_LIST (it is NULL), hence a crash. Solution: The fix is to block subquery evaluation inside Item_func_like::fix_fields and Item_func_like::select_optimize() using the Item::is_expensive() test.
Diffstat (limited to 'mysql-test/t/subselect_innodb.test')
-rw-r--r--mysql-test/t/subselect_innodb.test12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index a0c52196412..26ff1072e30 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -356,4 +356,16 @@ WHERE f2 >= (
drop table t1, t2, t3;
+--echo #
+--echo # LP BUG#1006231 crash in select_describe
+--echo #
+
+create table t1(a1 int) ENGINE=InnoDB;
+insert into t1 values (1);
+explain
+select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
+select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
+drop table t1;
+
+
set optimizer_switch=@subselect_innodb_tmp;