Commit 4bf5c7c5 authored by unknown's avatar unknown
Browse files

Test for BUG#4889 - inconsistent resilts of more than 2-way natural join

due to incorrect transformation to JOIN ... ON.

The bug itself is fixed by WL#2486.


mysql-test/r/select.result:
  Test for BUG#4889.
mysql-test/t/select.test:
  Test for BUG#4889.
parent b4e830c3
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2860,3 +2860,18 @@ a2 c
2	2
drop table t1, t2;
drop view v2;
create table t1 (a int(10), t1_val int(10));
create table t2 (b int(10), t2_val int(10));
create table t3 (a int(10), b int(10));
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(3,1),(4,1);
select * from t1 natural join t2 natural join t3;
a	b	t1_val	t2_val
1	1	1	1
2	1	2	1
select * from t1 natural join t3 natural join t2;
b	a	t1_val	t2_val
1	1	1	1
1	2	2	1
drop table t1, t2, t3;
+17 −0
Original line number Diff line number Diff line
@@ -2426,3 +2426,20 @@ select * from v2 natural right join t2;

drop table t1, t2;
drop view v2;


#
# Bug #4789 Incosistent results of more than 2-way natural joins due to
#           incorrect transformation to join ... on.
#

create table t1 (a int(10), t1_val int(10));
create table t2 (b int(10), t2_val int(10));
create table t3 (a int(10), b int(10));
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(3,1),(4,1);
# the following two queries must return the same result
select * from t1 natural join t2 natural join t3;
select * from t1 natural join t3 natural join t2;
drop table t1, t2, t3;