summaryrefslogtreecommitdiff
path: root/mysql-test/r/join.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-02-22 00:10:39 -0800
committerIgor Babaev <igor@askmonty.org>2012-02-22 00:10:39 -0800
commite0a5319db3f09d2f7b1a5caf358ca2f6e296df74 (patch)
treeecda5490d969cd593213ceb4e30971ec90c05a50 /mysql-test/r/join.result
parent86eebf33e3383aa5c59fb93473e64a202bc0badb (diff)
downloadmariadb-git-e0a5319db3f09d2f7b1a5caf358ca2f6e296df74.tar.gz
Back-ported the fix and test cases for bugs #59487 and #43368 from
the mysql-5.6 code line.
Diffstat (limited to 'mysql-test/r/join.result')
-rw-r--r--mysql-test/r/join.result49
1 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index dae3d16c781..41a05bb00bd 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1240,3 +1240,52 @@ f1 MIN(f2)
drop table t1,t2;
drop view v1,v2;
End of 5.1 tests
+#
+# Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS
+#
+create table t1(c1 int primary key, c2 char(10)) engine=myisam;
+create table t2(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
+create table t3(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
+create table t4(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
+insert into t1 values(1,'a');
+insert into t2 values(1,'a', 1);
+insert into t3 values(1,'a', 1);
+insert into t3 values(2,'b',2);
+insert into t4 values(1,'a', 1);
+insert into t4 values(2,'a', 2);
+insert into t4 values(3,'a', 3);
+insert into t4 values(4,'a', 4);
+insert into t1 values(2,'b');
+insert into t1 values(3,'c');
+EXPLAIN
+SELECT *
+FROM t4 JOIN
+(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
+ON t4.ref_t1=t1.c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 Using where; Using join buffer
+EXPLAIN
+SELECT STRAIGHT_JOIN *
+FROM t4 JOIN
+(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
+ON t4.ref_t1=t1.c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer
+EXPLAIN
+SELECT *
+FROM t4 STRAIGHT_JOIN
+(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
+ON t4.ref_t1=t1.c1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1
+drop table t1,t2,t3,t4;
+End of 5.2 tests