Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2021-11-29 10:33:06 +02:00
commit 289721de9a
40 changed files with 897 additions and 99 deletions

View file

@ -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 #