Skip to content

Commit d0d073b

Browse files
committed
Corrected and added back the test case for MDEV-15151.
1 parent 9827c5e commit d0d073b

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# MDEV-15151: function with recursive CTE using no base tables
3+
# (duplicate of MDEV-16661)
4+
#
5+
connection default;
6+
CREATE TABLE t1 (id int KEY);
7+
INSERT INTO t1 VALUES (0), (1),(2);
8+
CREATE OR REPLACE FUNCTION func() RETURNS int
9+
RETURN
10+
(
11+
WITH recursive cte AS
12+
(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1)
13+
SELECT * FROM cte limit 1
14+
);
15+
connect con1,localhost,root,,test;
16+
SELECT func();
17+
connect con2,localhost,root,,test;
18+
disconnect con2;
19+
connection con1;
20+
disconnect con1;
21+
connection default;
22+
DROP FUNCTION func;
23+
DROP TABLE t1;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--source include/not_embedded.inc
2+
3+
--echo #
4+
--echo # MDEV-15151: function with recursive CTE using no base tables
5+
--echo # (duplicate of MDEV-16661)
6+
--echo #
7+
8+
--connection default
9+
10+
CREATE TABLE t1 (id int KEY);
11+
INSERT INTO t1 VALUES (0), (1),(2);
12+
13+
CREATE OR REPLACE FUNCTION func() RETURNS int
14+
RETURN
15+
(
16+
WITH recursive cte AS
17+
(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1)
18+
SELECT * FROM cte limit 1
19+
);
20+
21+
--connect (con1,localhost,root,,test)
22+
23+
--let $conid= `SELECT CONNECTION_ID()`
24+
--send SELECT func()
25+
26+
--connect (con2,localhost,root,,test)
27+
--disable_query_log
28+
--eval KILL QUERY $conid
29+
--enable_query_log
30+
--disconnect con2
31+
32+
--disable_result_log
33+
--connection con1
34+
--error 0,ER_QUERY_INTERRUPTED
35+
--reap
36+
--disconnect con1
37+
--enable_result_log
38+
39+
--connection default
40+
41+
DROP FUNCTION func;
42+
DROP TABLE t1;

0 commit comments

Comments
 (0)