diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-19 11:42:44 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-19 11:42:44 +0200 |
commit | 44d70c01f0aef419bc1325f0cba6a46085042646 (patch) | |
tree | d12df15e2f47fbc884591bfec0e14fcb613fd7d3 /mysql-test/main/cte_nonrecursive.test | |
parent | 126725421e56293d7c8b816e066271606b59dcd5 (diff) | |
parent | 867724fd304caf714d3cd2aa825f2c8b3b724017 (diff) | |
download | mariadb-git-44d70c01f0aef419bc1325f0cba6a46085042646.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/main/cte_nonrecursive.test')
-rw-r--r-- | mysql-test/main/cte_nonrecursive.test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index 2242dce3769..49df2bb9ec0 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1230,6 +1230,37 @@ drop database db1; create database test; use test; +--echo # +--echo # MDEV-24597: CTE with union used multiple times in query +--echo # + +with cte(a) as +(select 1 as d union select 2 as d) +select a from cte as r1 +union +select a from cte as r2; + +create table t1 (a int, b int) engine=myisam; +insert into t1 values +(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44), +(5,50), (4,40), (3,33), (4,42), (4,43), (5,51); + +with cte(c) as +(select a from t1 where b < 30 union select a from t1 where b > 40) +select * from cte as r1, cte as r2 where r1.c = r2.c; + +with cte(a,c) as +( + select a, count(*) from t1 group by a having count(*) = 1 + union + select a, count(*) from t1 group by a having count(*) = 3 +) +select a, c from cte as r1 where a < 3 +union +select a, c from cte as r2 where a > 4; + +drop table t1; + --echo # End of 10.2 tests --echo # |