summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2010-04-15 17:04:24 +0300
committerGeorgi Kodinov <joro@sun.com>2010-04-15 17:04:24 +0300
commita8ae3cd6e9bf1713ec9508e7639f936c0b97316a (patch)
tree3802fe4c126313ee2f05b6b546702a0948f283f6 /mysql-test/t/subselect.test
parent5b54e86ec182b77e8937822bc787d1186bd6f779 (diff)
downloadmariadb-git-a8ae3cd6e9bf1713ec9508e7639f936c0b97316a.tar.gz
Bug #52711: Segfault when doing EXPLAIN SELECT with
union...order by (select... where...) The problem is mysql is trying to materialize and cache the scalar sub-queries at JOIN::optimize even for EXPLAIN where the number of columns is totally different from what's expected. Fixed by not executing the scalar subqueries for EXPLAIN.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r--mysql-test/t/subselect.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index c58faf60010..1f471b46c4e 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3701,3 +3701,28 @@ GROUP BY
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with
+--echo # union...order by (select... where...)
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+--disable_result_log
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+--enable_result_log
+
+--echo End of 5.1 tests