mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-1
This commit is contained in:
@ -59,11 +59,9 @@ id count(t2.id)
|
|||||||
107 1
|
107 1
|
||||||
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
|
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
|
||||||
id id
|
id id
|
||||||
NULL 75
|
|
||||||
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
|
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
|
||||||
explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0;
|
explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
@ -1208,3 +1208,22 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
|
|||||||
a a a
|
a a a
|
||||||
1 NULL NULL
|
1 NULL NULL
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
CREATE TABLE t1(a int, key (a));
|
||||||
|
CREATE TABLE t2(b int, key (b));
|
||||||
|
CREATE TABLE t3(c int, key (c));
|
||||||
|
INSERT INTO t1 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
|
||||||
|
(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
|
||||||
|
INSERT INTO t2 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
|
||||||
|
(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
|
||||||
|
INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5);
|
||||||
|
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index
|
||||||
|
1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index
|
||||||
|
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
|
||||||
|
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2 range b b 5 NULL 3 Using where; Using index
|
||||||
|
1 SIMPLE t3 ref c c 5 test.t2.b 2 Using where; Using index
|
||||||
|
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
@ -2181,10 +2181,10 @@ a a a
|
|||||||
select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
|
select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
|
||||||
a a a
|
a a a
|
||||||
1 1 2
|
1 1 2
|
||||||
1 1 3
|
|
||||||
2 2 2
|
2 2 2
|
||||||
2 2 3
|
|
||||||
3 3 2
|
3 3 2
|
||||||
|
1 1 3
|
||||||
|
2 2 3
|
||||||
3 3 3
|
3 3 3
|
||||||
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||||
a a a
|
a a a
|
||||||
|
@ -727,3 +727,23 @@ DELETE FROM t2;
|
|||||||
SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
|
SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
|
||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
#on expression for a nested outer join does not depend on the outer table
|
||||||
|
#bug #4976
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int, key (a));
|
||||||
|
CREATE TABLE t2(b int, key (b));
|
||||||
|
CREATE TABLE t3(c int, key (c));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
|
||||||
|
(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
|
||||||
|
|
||||||
|
INSERT INTO t2 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
|
||||||
|
(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
|
||||||
|
|
||||||
|
INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5);
|
||||||
|
|
||||||
|
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c;
|
||||||
|
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
@ -6077,8 +6077,10 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
|
|||||||
table->embedding->nested_join->used_tables|= used_tables;
|
table->embedding->nested_join->used_tables|= used_tables;
|
||||||
table->embedding->nested_join->not_null_tables|= not_null_tables;
|
table->embedding->nested_join->not_null_tables|= not_null_tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!table->outer_join || (used_tables & not_null_tables))
|
if (!table->outer_join || (used_tables & not_null_tables) ||
|
||||||
|
(table->outer_join &&
|
||||||
|
!(table->on_expr->used_tables() & ~used_tables)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
For some of the inner tables there are conjunctive predicates
|
For some of the inner tables there are conjunctive predicates
|
||||||
|
Reference in New Issue
Block a user