Commit 4c39f75c authored by Sergei Petrunia's avatar Sergei Petrunia

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

Add the testcase
parent 06ba09d6
...@@ -851,3 +851,16 @@ a ...@@ -851,3 +851,16 @@ a
9 9
drop view v1; drop view v1;
drop table ten, one_k; 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;
...@@ -535,3 +535,12 @@ select * from v1; ...@@ -535,3 +535,12 @@ select * from v1;
drop view v1; drop view v1;
drop table ten, one_k; 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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment