diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-29 10:33:06 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-29 10:33:06 +0200 |
commit | 289721de9aca8cdf3bdef1a010477e2d38eebb8d (patch) | |
tree | 50a9f9ea56a7a0b68210e1061ced47951298d2d9 /mysql-test/main/cte_nonrecursive.test | |
parent | 9962cda52722b77c2a7e0314bbaa2e4f963f55c1 (diff) | |
parent | f5441ef4dac9f3fd5dfe1bfa25a514715fee649f (diff) | |
download | mariadb-git-289721de9aca8cdf3bdef1a010477e2d38eebb8d.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main/cte_nonrecursive.test')
-rw-r--r-- | mysql-test/main/cte_nonrecursive.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index c748d3e70e0..41a0146e4d0 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1578,6 +1578,52 @@ drop function g; drop function f; drop table t1; +--echo # +--echo # MDEV-27086: union using CTEs in CREATE TABLE +--echo # + +create or replace temporary table tmp as +with cte1 as (select 1 as a), cte2 as (select 2 as a) +select * from cte1 union select * from cte2; +select * from tmp; + +create table t1 as +with cte1 as (select 1 as a), cte2 as (select 2 as a) +select * from cte1 union select * from cte2; +select * from t1; + +insert into t1 values (3); + +create table t2 as +with cte1 as (select * from t1 where a <2), cte2 as (select * from t1 where a > 2) +select * from cte1 union select * from cte2; +select * from t2; + +drop table t1,t2; + +--echo # +--echo # MDEV-26470: CTE in WITH clause of subquery used in DELETE +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1), (5); + +create table t2 (b int); +insert into t2 values (4), (1), (3), (2); + +delete from t1 + where a in (with cte(a) as (select * from t2 where b <=2) select a from cte); +select * from t1; + +insert into t1 values (1), (3); + +delete t1 from t1, t2 + where t1.a=t2.b or + t1.a in (with cte(a) as (select b+1 from t2) select * from cte); +select * from t1; + +drop table t1,t2; + --echo # End of 10.2 tests --echo # |