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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c813e97c
Commit
c813e97c
authored
Jun 15, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
parents
d925e516
ad57284c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+22
-0
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+18
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/join_nested.result
View file @
c813e97c
...
@@ -1321,3 +1321,25 @@ NULL NULL NULL
...
@@ -1321,3 +1321,25 @@ NULL NULL NULL
18 NULL NULL
18 NULL NULL
19 NULL NULL
19 NULL NULL
DROP TABLE t1,t2,t3;
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (c11 int);
CREATE TABLE t2 (c21 int);
CREATE TABLE t3 (c31 int);
INSERT INTO t1 VALUES (4), (5);
SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
c11 c21
4 NULL
5 NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
c11 c21 c31
4 NULL NULL
5 NULL NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 0
1 SIMPLE t3 ALL NULL NULL NULL NULL 0
DROP TABLE t1,t2,t3;
mysql-test/t/join_nested.test
View file @
c813e97c
...
@@ -752,3 +752,21 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
...
@@ -752,3 +752,21 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
SELECT
a
,
b
,
c
FROM
t1
LEFT
JOIN
(
t2
,
t3
)
ON
b
<
3
and
b
=
c
;
SELECT
a
,
b
,
c
FROM
t1
LEFT
JOIN
(
t2
,
t3
)
ON
b
<
3
and
b
=
c
;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Test for bug #11284: empty table in a nested left join
#
CREATE
TABLE
t1
(
c11
int
);
CREATE
TABLE
t2
(
c21
int
);
CREATE
TABLE
t3
(
c31
int
);
INSERT
INTO
t1
VALUES
(
4
),
(
5
);
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
c11
=
c21
;
EXPLAIN
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
c11
=
c21
;
SELECT
*
FROM
t1
LEFT
JOIN
(
t2
LEFT
JOIN
t3
ON
c21
=
c31
)
ON
c11
=
c21
;
EXPLAIN
SELECT
*
FROM
t1
LEFT
JOIN
(
t2
LEFT
JOIN
t3
ON
c21
=
c31
)
ON
c11
=
c21
;
DROP
TABLE
t1
,
t2
,
t3
;
sql/sql_select.cc
View file @
c813e97c
...
@@ -2158,7 +2158,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
...
@@ -2158,7 +2158,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if
(
*
s
->
on_expr_ref
)
if
(
*
s
->
on_expr_ref
)
{
{
/* s is the only inner table of an outer join */
/* s is the only inner table of an outer join */
if
(
!
table
->
file
->
records
)
if
(
!
table
->
file
->
records
&&
!
embedding
)
{
// Empty table
{
// Empty table
s
->
dependent
=
0
;
// Ignore LEFT JOIN depend.
s
->
dependent
=
0
;
// Ignore LEFT JOIN depend.
set_position
(
join
,
const_count
++
,
s
,(
KEYUSE
*
)
0
);
set_position
(
join
,
const_count
++
,
s
,(
KEYUSE
*
)
0
);
...
...
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