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
e7b2de98
Commit
e7b2de98
authored
Apr 27, 2005
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be sure to call top_level_item() on the new Item_cond_and,
that merges ON and WHERE (BUG#10162)
parent
83978acd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
mysql-test/r/join_outer.result
mysql-test/r/join_outer.result
+14
-0
mysql-test/t/join_outer.test
mysql-test/t/join_outer.test
+15
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/join_outer.result
View file @
e7b2de98
...
...
@@ -943,3 +943,17 @@ Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
drop table t1, t2;
set group_concat_max_len=default;
create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y));
insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
create table t2 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, id int(11) not null, primary key (gid,id,x,y), key id (id));
insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
create table t3 ( set_id smallint(5) unsigned not null, id tinyint(4) unsigned not null, name char(12) not null, primary key (id,set_id));
insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e'), (1, 4, 'f'), (1, 5, 'g'), (1, 6, 'h');
explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8
and t1.gid =1 and t2.gid =1 and t3.set_id =1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 10 const,const,const 1
1 SIMPLE t2 const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 3 const,const 1
drop tables t1,t2,t3;
mysql-test/t/join_outer.test
View file @
e7b2de98
...
...
@@ -661,3 +661,18 @@ select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
select
group_concat
(
t1
.
b
,
t2
.
c
)
from
t1
inner
join
t2
using
(
a
)
group
by
t1
.
a
;
drop
table
t1
,
t2
;
set
group_concat_max_len
=
default
;
#
# BUG#10162 - ON is merged with WHERE, left join is convered to a regular join
#
create
table
t1
(
gid
smallint
(
5
)
unsigned
not
null
,
x
int
(
11
)
not
null
,
y
int
(
11
)
not
null
,
art
int
(
11
)
not
null
,
primary
key
(
gid
,
x
,
y
));
insert
t1
values
(
1
,
-
5
,
-
8
,
2
),
(
1
,
2
,
2
,
1
),
(
1
,
1
,
1
,
1
);
create
table
t2
(
gid
smallint
(
5
)
unsigned
not
null
,
x
int
(
11
)
not
null
,
y
int
(
11
)
not
null
,
id
int
(
11
)
not
null
,
primary
key
(
gid
,
id
,
x
,
y
),
key
id
(
id
));
insert
t2
values
(
1
,
-
5
,
-
8
,
1
),
(
1
,
1
,
1
,
1
),
(
1
,
2
,
2
,
1
);
create
table
t3
(
set_id
smallint
(
5
)
unsigned
not
null
,
id
tinyint
(
4
)
unsigned
not
null
,
name
char
(
12
)
not
null
,
primary
key
(
id
,
set_id
));
insert
t3
values
(
0
,
1
,
'a'
),
(
1
,
1
,
'b'
),
(
0
,
2
,
'c'
),
(
1
,
2
,
'd'
),
(
1
,
3
,
'e'
),
(
1
,
4
,
'f'
),
(
1
,
5
,
'g'
),
(
1
,
6
,
'h'
);
explain
select
name
from
t1
left
join
t2
on
t1
.
x
=
t2
.
x
and
t1
.
y
=
t2
.
y
left
join
t3
on
t1
.
art
=
t3
.
id
where
t2
.
id
=
1
and
t2
.
x
=
-
5
and
t2
.
y
=-
8
and
t1
.
gid
=
1
and
t2
.
gid
=
1
and
t3
.
set_id
=
1
;
drop
tables
t1
,
t2
,
t3
;
sql/sql_select.cc
View file @
e7b2de98
...
...
@@ -7396,6 +7396,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
if
(
conds
)
{
conds
=
and_conds
(
conds
,
table
->
on_expr
);
conds
->
top_level_item
();
/* conds is always a new item as both cond and on_expr existed */
DBUG_ASSERT
(
!
conds
->
fixed
);
conds
->
fix_fields
(
join
->
thd
,
0
,
&
conds
);
...
...
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