1# 2# MDEV-15151: function with recursive CTE using no base tables 3# (duplicate of MDEV-16661) 4# 5connection default; 6CREATE TABLE t1 (id int KEY); 7INSERT INTO t1 VALUES (0), (1),(2); 8CREATE OR REPLACE FUNCTION func() RETURNS int 9RETURN 10( 11WITH recursive cte AS 12(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1) 13SELECT * FROM cte limit 1 14); 15connect con1,localhost,root,,test; 16SELECT func(); 17connect con2,localhost,root,,test; 18disconnect con2; 19connection con1; 20disconnect con1; 21connection default; 22DROP FUNCTION func; 23DROP TABLE t1; 24