mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
SCRUM Task 430: Allowing braces in joins by simply removing them.
Fixed the remaining join variations, (left, right, natural, etc). (Previous fix only solved "," and "[cross] join".) mysql-test/r/select.result: Added more test case results for more braced join fixes. mysql-test/t/select.test: Added more tests for braced join fixes. sql/sql_yacc.yy: Changed the remaining join_table_list cases to handle braces. Also added some precedence declaration to silence shift/reduce conflicts warnings that turned up after these fixes.
This commit is contained in:
@ -3292,4 +3292,179 @@ a a a
|
||||
1 3 3
|
||||
2 3 3
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 1
|
||||
3 3 1
|
||||
1 1 2
|
||||
2 2 2
|
||||
3 3 2
|
||||
1 1 3
|
||||
2 2 3
|
||||
3 3 3
|
||||
select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
|
||||
a a a
|
||||
1 1 1
|
||||
2 1 1
|
||||
3 1 1
|
||||
1 2 2
|
||||
2 2 2
|
||||
3 2 2
|
||||
1 3 3
|
||||
2 3 3
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
|
||||
a a a
|
||||
1 1 2
|
||||
2 2 2
|
||||
3 3 2
|
||||
1 1 3
|
||||
2 2 3
|
||||
3 3 3
|
||||
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||
a a a
|
||||
1 1 NULL
|
||||
2 1 1
|
||||
3 1 1
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 2
|
||||
1 3 NULL
|
||||
2 3 3
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 1 NULL
|
||||
3 1 NULL
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 NULL
|
||||
1 3 NULL
|
||||
2 3 NULL
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
|
||||
a a a
|
||||
1 1 2
|
||||
1 1 3
|
||||
2 2 2
|
||||
2 2 3
|
||||
3 3 2
|
||||
3 3 3
|
||||
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||
a a a
|
||||
1 1 NULL
|
||||
2 1 1
|
||||
3 1 1
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 2
|
||||
1 3 NULL
|
||||
2 3 3
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 1 NULL
|
||||
3 1 NULL
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 NULL
|
||||
1 3 NULL
|
||||
2 3 NULL
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
|
||||
a a a
|
||||
1 1 1
|
||||
2 1 NULL
|
||||
3 1 NULL
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 NULL
|
||||
1 3 NULL
|
||||
2 3 NULL
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
|
||||
a a a
|
||||
1 NULL 1
|
||||
2 NULL 1
|
||||
3 NULL 1
|
||||
1 1 2
|
||||
2 2 2
|
||||
3 3 2
|
||||
1 1 3
|
||||
2 2 3
|
||||
3 3 3
|
||||
select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||
a a a
|
||||
2 1 1
|
||||
3 1 1
|
||||
2 2 2
|
||||
3 2 2
|
||||
2 3 3
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 NULL 1
|
||||
3 NULL 1
|
||||
1 NULL 2
|
||||
2 2 2
|
||||
3 NULL 2
|
||||
1 NULL 3
|
||||
2 NULL 3
|
||||
3 3 3
|
||||
select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
|
||||
a a a
|
||||
1 1 1
|
||||
2 NULL 1
|
||||
3 NULL 1
|
||||
1 NULL 2
|
||||
2 2 2
|
||||
3 NULL 2
|
||||
1 NULL 3
|
||||
2 NULL 3
|
||||
3 3 3
|
||||
select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
|
||||
a a a
|
||||
1 1 1
|
||||
2 1 NULL
|
||||
3 1 NULL
|
||||
1 2 NULL
|
||||
2 2 2
|
||||
3 2 NULL
|
||||
1 3 NULL
|
||||
2 3 NULL
|
||||
3 3 3
|
||||
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
|
||||
a a a
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user