summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2004-12-21 01:59:58 +0300
committerunknown <sergefp@mysql.com>2004-12-21 01:59:58 +0300
commit1fc04e0b1202857c2b5e245f2f1654d3f49a11e3 (patch)
treee1ee175753e328dee278bc7a57527ff7a68aa085 /mysql-test
parentde5ce11108f636dfc2d61eaaa77cc3604e767383 (diff)
downloadmariadb-git-1fc04e0b1202857c2b5e245f2f1654d3f49a11e3.tar.gz
Fix for BUG#4480: In joins with SELECT_STRAIGHT_JOIN re-order tables by outer join dependency,
so we read dependent tables after tables they depend on (this is needed for outer joins) mysql-test/r/join_outer.result: Test for BUG#4480 mysql-test/t/join_outer.test: Test for BUG#4480
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/join_outer.result15
-rw-r--r--mysql-test/t/join_outer.test10
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 2f420905195..b7343065c73 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -853,4 +853,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
+drop table t1,t2;
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (a int, b int);
+insert into t2 values (1,1), (2,2);
+select * from t2 right join t1 on t2.a=t1.a;
+a b a b
+1 1 1 1
+2 2 2 2
+NULL NULL 3 3
+select straight_join * from t2 right join t1 on t2.a=t1.a;
+a b a b
+1 1 1 1
+2 2 2 2
+NULL NULL 3 3
DROP TABLE t0,t1,t2,t3;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 665b4fafbca..ce2ce577b46 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -606,4 +606,14 @@ INSERT INTO t1 VALUES (0);
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
+# Test for BUG#4480
+drop table t1,t2;
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (a int, b int);
+insert into t2 values (1,1), (2,2);
+
+select * from t2 right join t1 on t2.a=t1.a;
+select straight_join * from t2 right join t1 on t2.a=t1.a;
+
DROP TABLE t0,t1,t2,t3;