1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

SQL: RIGHT JOIN in derived [fix #383]

This commit is contained in:
Aleksey Midenkov
2017-12-12 20:27:47 +03:00
parent cb4657e3b4
commit a0e137c4a9
4 changed files with 163 additions and 14 deletions

View File

@ -151,5 +151,61 @@ select y from t2 for system_time as of @t1;
select x from t1 for system_time as of @t0 union
select y from t2 for system_time as of @t1;
--echo # LEFT/RIGHT JOIN
create or replace table t1 (x int, y int) with system versioning;
create or replace table t2 (x int, y int) with system versioning;
insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
insert into t2 values (1, 2), (2, 1), (3, 1);
--echo ## LEFT JOIN: t1, t2 versioned
select * from (
select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 left join t2 on t1.x = t2.x)
as derived;
alter table t2 drop system versioning;
--echo ## LEFT JOIN: t1 versioned
select * from (
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 left join t2 on t1.x = t2.x)
as derived;
alter table t1 drop system versioning;
alter table t2 add system versioning;
--echo ## LEFT JOIN: t2 versioned
select * from (
select t1.x as LJ3_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 left join t2 on t1.x = t2.x)
as derived;
alter table t1 add system versioning;
--echo ## RIGHT JOIN: t1, t2 versioned
select * from (
select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 right join t2 on t1.x = t2.x)
as derived;
alter table t2 drop system versioning;
--echo ## RIGHT JOIN: t1 versioned
select * from (
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 right join t2 on t1.x = t2.x)
as derived;
alter table t1 drop system versioning;
alter table t2 add system versioning;
--echo ## RIGHT JOIN: t2 versioned
select * from (
select t1.x as RJ3_x1, t1.y as y1, t2.x as x2, t2.y as y2
from t1 right join t2 on t1.x = t2.x)
as derived;
drop table t1, t2;
drop view vt1, vt2;