403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/mysql/mysql-test/main/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/mysql/mysql-test/main/cte_cycle.test
--echo #
--echo # check errors
--echo #

--error ER_DUP_FIELDNAME
WITH RECURSIVE cte AS (
        SELECT 1 AS a UNION ALL
        SELECT NULL FROM cte WHERE a IS NOT NULL)
        CYCLE a, a RESTRICT
SELECT * FROM cte;

--error ER_BAD_FIELD_ERROR
WITH RECURSIVE cte AS (
        SELECT 1 AS a UNION ALL
        SELECT NULL FROM cte WHERE a IS NOT NULL)
        CYCLE b RESTRICT
SELECT * FROM cte;

--error ER_PARSE_ERROR
WITH cte AS (
        SELECT 1 AS a UNION ALL
        SELECT NULL FROM cte WHERE a IS NOT NULL)
        CYCLE b RESTRICT
SELECT * FROM cte;


--echo #
--echo # A degenerate case
--echo #

WITH RECURSIVE cte AS (
	SELECT 1 AS a, 2 as b)
   CYCLE b RESTRICT
SELECT * FROM cte;


--echo #
--echo # A simple case
--echo #

WITH RECURSIVE cte AS (
	SELECT 1 AS a, 2 as b UNION ALL
	SELECT 2, 2 FROM cte WHERE a IS NOT NULL)
        CYCLE b RESTRICT
SELECT * FROM cte;


--echo #
--echo # MDEV-20632 case (with fixed syntax)
--echo #

create table t1 (from_ int, to_ int);
insert into t1 values (1,2), (1,100), (2,3), (3,4), (4,1);

WITH RECURSIVE cte (depth, from_, to_) as (
   SELECT 0,1,1
   UNION
   SELECT depth+1, t1.from_, t1.to_
      FROM t1, cte WHERE t1.from_ = cte.to_
) CYCLE from_, to_ RESTRICT
select * from cte;

create view v1 as WITH RECURSIVE cte (depth, from_, to_) as (
   SELECT 0,1,1
   UNION
   SELECT depth+1, t1.from_, t1.to_
      FROM t1, cte WHERE t1.from_ = cte.to_
) CYCLE from_, to_ RESTRICT
select * from cte;

show create view v1;

select * from v1;

delete from t1;

insert into t1 values (1,2), (1,NULL), (NULL,NULL), (NULL, 1);

select * from v1;

drop view v1;

drop table t1;


--echo #
--echo # A simple blob case
--echo #

create table t1 (a int, b text);
insert into t1 values (1, "a");

WITH RECURSIVE cte AS (
	SELECT a, b  from t1 UNION ALL
	SELECT a, b FROM cte WHERE a IS NOT NULL)
        CYCLE b RESTRICT
SELECT * FROM cte;

drop table t1;

--echo #
--echo # check bit types
--echo #

create table t1 (from_ bit(3), to_ bit(3));
insert into t1 values (1,2), (1,7), (2,3), (3,4), (4,1);

WITH RECURSIVE cte (depth, from_, to_) as (
   SELECT 0,1,1
   UNION
   SELECT depth+1, t1.from_, t1.to_
      FROM t1, cte WHERE t1.from_ = cte.to_
) CYCLE from_, to_ RESTRICT
select * from cte;
drop table t1;

--echo #
--echo # check bit types with BLOBs (TEXT)
--echo #

create table t1 (from_ bit(3), to_ bit(3), load_ text);
insert into t1 values (1,2,"A"), (1,7,"A"), (2,3,"A"), (3,4,"A"), (4,1,"A");

WITH RECURSIVE cte (depth, from_, to_, load_) as (
   SELECT 0,1,1,"A"
   UNION
   SELECT depth+1, t1.from_, t1.to_, t1.load_
      FROM t1, cte WHERE t1.from_ = cte.to_
) CYCLE from_, to_, load_ RESTRICT
select * from cte;
insert into t1 values (4,1,"B");
WITH RECURSIVE cte (depth, from_, to_, load_) as (
   SELECT 0,1,1,"A"
   UNION
   SELECT depth+1, t1.from_, t1.to_, t1.load_
      FROM t1, cte WHERE t1.from_ = cte.to_
) CYCLE from_, to_, load_ RESTRICT
select * from cte;

drop table t1;



Youez - 2016 - github.com/yon3zu
LinuXploit