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
2763b52d
Commit
2763b52d
authored
Jul 25, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
outer join, impossible on condition, where, and usable key for range
bug#926
parent
9dce7500
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
4 deletions
+40
-4
mysql-test/r/select.result
mysql-test/r/select.result
+20
-0
mysql-test/t/select.test
mysql-test/t/select.test
+20
-0
sql/sql_select.cc
sql/sql_select.cc
+0
-4
No files found.
mysql-test/r/select.result
View file @
2763b52d
...
...
@@ -3508,3 +3508,23 @@ aa id t2_id id
5 8303 2520 2520
6 8304 2521 2521
drop table t1,t2;
create table t1 (id1 int NOT NULL);
create table t2 (id2 int NOT NULL);
create table t3 (id3 int NOT NULL);
create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
insert into t1 values (1);
insert into t1 values (2);
insert into t2 values (1);
insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
table type possible_keys key key_len ref rows Extra
t3 system NULL NULL NULL NULL 0 const row not found
t1 ALL NULL NULL NULL NULL 2
t2 ALL NULL NULL NULL NULL 1
t4 ALL id4 NULL NULL NULL 1 Using where
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id1 id2 id3 id4 id44
1 1 NULL NULL NULL
drop table t1,t2,t3,t4;
mysql-test/t/select.test
View file @
2763b52d
...
...
@@ -1832,3 +1832,23 @@ INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select
*
from
t1
,
t2
WHERE
t1
.
t2_id
=
t2
.
id
and
t1
.
t2_id
>
0
order
by
t1
.
id
LIMIT
0
,
5
;
drop
table
t1
,
t2
;
#
# outer join, impossible on condition, where, and usable key for range
#
create
table
t1
(
id1
int
NOT
NULL
);
create
table
t2
(
id2
int
NOT
NULL
);
create
table
t3
(
id3
int
NOT
NULL
);
create
table
t4
(
id4
int
NOT
NULL
,
id44
int
NOT
NULL
,
KEY
(
id4
));
insert
into
t1
values
(
1
);
insert
into
t1
values
(
2
);
insert
into
t2
values
(
1
);
insert
into
t4
values
(
1
,
1
);
explain
select
*
from
t1
left
join
t2
on
id1
=
id2
left
join
t3
on
id1
=
id3
left
join
t4
on
id3
=
id4
where
id2
=
1
or
id4
=
1
;
select
*
from
t1
left
join
t2
on
id1
=
id2
left
join
t3
on
id1
=
id3
left
join
t4
on
id3
=
id4
where
id2
=
1
or
id4
=
1
;
drop
table
t1
,
t2
,
t3
,
t4
;
sql/sql_select.cc
View file @
2763b52d
...
...
@@ -2641,9 +2641,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join
->
thd
->
select_limit
<
join
->
best_positions
[
i
].
records_read
&&
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
)))
{
/* Join with outer join condition */
COND
*
orig_cond
=
sel
->
cond
;
sel
->
cond
=
and_conds
(
sel
->
cond
,
tab
->
on_expr
);
if
(
sel
->
test_quick_select
(
tab
->
keys
,
used_tables
&
~
current_map
,
(
join
->
select_options
&
...
...
@@ -2651,7 +2648,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
HA_POS_ERROR
:
join
->
thd
->
select_limit
))
<
0
)
DBUG_RETURN
(
1
);
// Impossible range
sel
->
cond
=
orig_cond
;
/* Fix for EXPLAIN */
if
(
sel
->
quick
)
join
->
best_positions
[
i
].
records_read
=
sel
->
quick
->
records
;
...
...
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