Skip to content

Commit 9eaf934

Browse files
committed
Update test result after the last commit
1 parent 5c68bc2 commit 9eaf934

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

mysql-test/r/join_outer_jcl6.result

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,69 @@ id select_type table type possible_keys key key_len ref rows Extra
22842284
1 SIMPLE t1 ALL NULL NULL NULL NULL 9
22852285
1 SIMPLE t2 ref c c 5 const 393 Using where
22862286
drop table t1,t2;
2287+
#
2288+
# MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause
2289+
#
2290+
CREATE TABLE t1(i1 int primary key, v1 int, key(v1));
2291+
INSERT INTO t1 VALUES (1, 1);
2292+
INSERT INTO t1 VALUES (2, 2);
2293+
INSERT INTO t1 VALUES (3, 3);
2294+
INSERT INTO t1 VALUES (4, 4);
2295+
INSERT INTO t1 VALUES (5, 3);
2296+
INSERT INTO t1 VALUES (6, 6);
2297+
INSERT INTO t1 VALUES (7, 7);
2298+
INSERT INTO t1 VALUES (8, 8);
2299+
INSERT INTO t1 VALUES (9, 9);
2300+
CREATE TABLE t2(i2 int primary key, v2 int, key(v2));
2301+
INSERT INTO t2 VALUES (1, 1);
2302+
INSERT INTO t2 VALUES (2, 2);
2303+
INSERT INTO t2 VALUES (3, 3);
2304+
INSERT INTO t2 VALUES (4, 4);
2305+
INSERT INTO t2 VALUES (5, 3);
2306+
INSERT INTO t2 VALUES (6, 6);
2307+
INSERT INTO t2 VALUES (7, 7);
2308+
INSERT INTO t2 VALUES (8, 8);
2309+
INSERT INTO t2 VALUES (9, 9);
2310+
CREATE TABLE t3(i3 int primary key, v3 int, key(v3));
2311+
INSERT INTO t3 VALUES (2, 2);
2312+
INSERT INTO t3 VALUES (4, 4);
2313+
INSERT INTO t3 VALUES (6, 6);
2314+
INSERT INTO t3 VALUES (8, 8);
2315+
# This should have a join order of t3,t1,t2 (or t3,t2,t1, the idea is that t3 is the first one)
2316+
EXPLAIN EXTENDED
2317+
SELECT * FROM
2318+
(SELECT t1.i1 as i1, t1.v1 as v1,
2319+
t2.i2 as i2, t2.v2 as v2,
2320+
t3.i3 as i3, t3.v3 as v3
2321+
FROM t1 JOIN t2 on t1.i1 = t2.i2
2322+
LEFT JOIN t3 on t2.i2 = t3.i3
2323+
) as w1
2324+
WHERE v3 = 4;
2325+
id select_type table type possible_keys key key_len ref rows filtered Extra
2326+
1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00
2327+
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
2328+
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
2329+
Warnings:
2330+
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
2331+
# This should have the same join order like the query above:
2332+
EXPLAIN EXTENDED
2333+
SELECT * FROM
2334+
(SELECT t1.i1 as i1, t1.v1 as v1,
2335+
t2.i2 as i2, t2.v2 as v2,
2336+
t3.i3 as i3, t3.v3 as v3
2337+
FROM t1 JOIN t2 on t1.i1 = t2.i2
2338+
LEFT JOIN t3 on t2.i2 = t3.i3
2339+
WHERE t1.i1 = t2.i2
2340+
AND 1 = 1
2341+
) as w2
2342+
WHERE v3 = 4;
2343+
id select_type table type possible_keys key key_len ref rows filtered Extra
2344+
1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00
2345+
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
2346+
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
2347+
Warnings:
2348+
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`v3` = 4) and (`test`.`t1`.`i1` = `test`.`t3`.`i3`) and (`test`.`t2`.`i2` = `test`.`t3`.`i3`))
2349+
drop table t1,t2,t3;
22872350
SET optimizer_switch=@save_optimizer_switch;
22882351
set join_cache_level=default;
22892352
show variables like 'join_cache_level';

0 commit comments

Comments
 (0)