Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0ee657d1
Commit
0ee657d1
authored
Aug 10, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-1
parents
4d87c483
0cb85479
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
7 deletions
+46
-7
mysql-test/r/join.result
mysql-test/r/join.result
+1
-3
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+19
-0
mysql-test/r/select.result
mysql-test/r/select.result
+2
-2
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+20
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-2
No files found.
mysql-test/r/join.result
View file @
0ee657d1
...
...
@@ -59,11 +59,9 @@ id count(t2.id)
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;
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;
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 t2 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
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
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
...
...
mysql-test/r/join_nested.result
View file @
0ee657d1
...
...
@@ -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
1 NULL NULL
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;
mysql-test/r/select.result
View file @
0ee657d1
...
...
@@ -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;
a a a
1 1 2
1 1 3
2 2 2
2 2 3
3 3 2
1 1 3
2 2 3
3 3 3
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
a a a
...
...
mysql-test/t/join_nested.test
View file @
0ee657d1
...
...
@@ -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
;
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
;
sql/sql_select.cc
View file @
0ee657d1
...
...
@@ -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
->
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment