summaryrefslogtreecommitdiff
path: root/mysql-test/r/join.result
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2012-02-24 20:07:12 +0400
committerSergey Petrunya <psergey@askmonty.org>2012-02-24 20:07:12 +0400
commit2256ecdd7cfaccec4f081f48bb361e7e9a008263 (patch)
tree6812095b7c11a26f6cc101408241413a4b024fa5 /mysql-test/r/join.result
parentd206480605cdf70925ba10897ee5856d7c0920ec (diff)
parent0919edf32d29b9371288ce1a5f4e03f051bb8093 (diff)
downloadmariadb-git-2256ecdd7cfaccec4f081f48bb361e7e9a008263.tar.gz
Merge 5.2->5.3
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 b1cfd80490d..e196cb8170b 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1275,6 +1275,55 @@ Handler_read_rnd_next 1
DROP TABLE t1, t2;
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 (flat, BNL join)
+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 (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
+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 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+drop table t1,t2,t3,t4;
+End of 5.2 tests
+#
# BUG#724275: Crash in JOIN::optimize in maria-5.3
#
create table t1 (a int);