[Commits] 4c39f75: MDEV-10057: Crash with EXPLAIN + WITH + constant query

Sergei Petrunia psergey at askmonty.org
Wed Sep 7 11:35:07 EEST 2016


revision-id: 4c39f75c73dfd9fa7e593ecfb5fa6e4272848d48
parent(s): 06ba09d604012bb789c64a007e169e86bf1bd3c2
committer: Sergei Petrunia
branch nick: 10.2
timestamp: 2016-09-07 11:35:06 +0300
message:

MDEV-10057: Crash with EXPLAIN + WITH + constant query

Add the testcase

---
 mysql-test/r/cte_nonrecursive.result |   13 +++++++++++++
 mysql-test/t/cte_nonrecursive.test   |    9 +++++++++
 2 files changed, 22 insertions(+)

diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 3b35874..9ecc098 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -851,3 +851,16 @@ a
 9
 drop view v1;
 drop table ten, one_k;
+#
+# MDEV-10057 : Crash with EXPLAIN + WITH + constant query
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+1
+1
+EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+DROP TABLE t1;
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index 414b1c2..caa8fee 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -535,3 +535,12 @@ select * from v1;
 
 drop view v1;
 drop table ten, one_k;
+
+--echo #
+--echo # MDEV-10057 : Crash with EXPLAIN + WITH + constant query
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
+DROP TABLE t1;


More information about the commits mailing list