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
39ba8376
Commit
39ba8376
authored
Sep 30, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into mysql.com:/home/timka/mysql/src/5.0-bug-13597
parents
ff2f28d9
68a91293
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
6 deletions
+65
-6
mysql-test/r/select.result
mysql-test/r/select.result
+23
-0
mysql-test/t/select.test
mysql-test/t/select.test
+34
-0
sql/table.cc
sql/table.cc
+8
-6
No files found.
mysql-test/r/select.result
View file @
39ba8376
...
@@ -3038,3 +3038,26 @@ id
...
@@ -3038,3 +3038,26 @@ id
102
102
drop table t1, t2;
drop table t1, t2;
drop view v1, v2, v3;
drop view v1, v2, v3;
create table a (
id int(11) not null default '0'
) engine=myisam default charset=latin1;
insert into a values (123),(191),(192);
create table b (
id char(16) character set utf8 not null default ''
) engine=myisam default charset=latin1;
insert into b values ('58013'),('58014'),('58015'),('58016');
create table c (
a_id int(11) not null default '0',
b_id char(16) character set utf8 default null
) engine=myisam default charset=latin1;
insert into c values
(123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
select count(*)
from a inner join (c left join b on b.id = c.b_id) on a.id = c.a_id;
count(*)
6
select count(*)
from a inner join (b right join c on b.id = c.b_id) on a.id = c.a_id;
count(*)
6
drop table a, b, c;
mysql-test/t/select.test
View file @
39ba8376
...
@@ -2575,3 +2575,37 @@ select * from v1 left join v3 using (id);
...
@@ -2575,3 +2575,37 @@ select * from v1 left join v3 using (id);
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
drop
view
v1
,
v2
,
v3
;
drop
view
v1
,
v2
,
v3
;
#
# Bug #13597 Column in ON condition not resolved if references a table in
# nested right join.
#
create
table
a
(
id
int
(
11
)
not
null
default
'0'
)
engine
=
myisam
default
charset
=
latin1
;
insert
into
a
values
(
123
),(
191
),(
192
);
create
table
b
(
id
char
(
16
)
character
set
utf8
not
null
default
''
)
engine
=
myisam
default
charset
=
latin1
;
insert
into
b
values
(
'58013'
),(
'58014'
),(
'58015'
),(
'58016'
);
create
table
c
(
a_id
int
(
11
)
not
null
default
'0'
,
b_id
char
(
16
)
character
set
utf8
default
null
)
engine
=
myisam
default
charset
=
latin1
;
insert
into
c
values
(
123
,
null
),(
123
,
null
),(
123
,
null
),(
123
,
null
),(
123
,
null
),(
123
,
'58013'
);
--
both
queries
are
equivalent
select
count
(
*
)
from
a
inner
join
(
c
left
join
b
on
b
.
id
=
c
.
b_id
)
on
a
.
id
=
c
.
a_id
;
select
count
(
*
)
from
a
inner
join
(
b
right
join
c
on
b
.
id
=
c
.
b_id
)
on
a
.
id
=
c
.
a_id
;
drop
table
a
,
b
,
c
;
sql/table.cc
View file @
39ba8376
...
@@ -2291,8 +2291,10 @@ TABLE_LIST *st_table_list::first_leaf_for_name_resolution()
...
@@ -2291,8 +2291,10 @@ TABLE_LIST *st_table_list::first_leaf_for_name_resolution()
List_iterator_fast
<
TABLE_LIST
>
it
(
cur_nested_join
->
join_list
);
List_iterator_fast
<
TABLE_LIST
>
it
(
cur_nested_join
->
join_list
);
cur_table_ref
=
it
++
;
cur_table_ref
=
it
++
;
/*
/*
If 'this' is a RIGHT JOIN, the operands in 'join_list' are in reverse
If the current nested join is a RIGHT JOIN, the operands in
order, thus the first operand is already at the front of the list.
'join_list' are in reverse order, thus the first operand is
already at the front of the list. Otherwise the first operand
is in the end of the list of join operands.
*/
*/
if
(
!
(
cur_table_ref
->
outer_join
&
JOIN_TYPE_RIGHT
))
if
(
!
(
cur_table_ref
->
outer_join
&
JOIN_TYPE_RIGHT
))
{
{
...
@@ -2343,9 +2345,11 @@ TABLE_LIST *st_table_list::last_leaf_for_name_resolution()
...
@@ -2343,9 +2345,11 @@ TABLE_LIST *st_table_list::last_leaf_for_name_resolution()
cur_nested_join
;
cur_nested_join
;
cur_nested_join
=
cur_table_ref
->
nested_join
)
cur_nested_join
=
cur_table_ref
->
nested_join
)
{
{
cur_table_ref
=
cur_nested_join
->
join_list
.
head
();
/*
/*
If 'this' is a RIGHT JOIN, the operands in 'join_list' are in reverse
If the current nested is a RIGHT JOIN, the operands in
order, thus the last operand is in the end of the list.
'join_list' are in reverse order, thus the last operand is in the
end of the list.
*/
*/
if
((
cur_table_ref
->
outer_join
&
JOIN_TYPE_RIGHT
))
if
((
cur_table_ref
->
outer_join
&
JOIN_TYPE_RIGHT
))
{
{
...
@@ -2355,8 +2359,6 @@ TABLE_LIST *st_table_list::last_leaf_for_name_resolution()
...
@@ -2355,8 +2359,6 @@ TABLE_LIST *st_table_list::last_leaf_for_name_resolution()
while
((
next
=
it
++
))
while
((
next
=
it
++
))
cur_table_ref
=
next
;
cur_table_ref
=
next
;
}
}
else
cur_table_ref
=
cur_nested_join
->
join_list
.
head
();
if
(
cur_table_ref
->
is_leaf_for_name_resolution
())
if
(
cur_table_ref
->
is_leaf_for_name_resolution
())
break
;
break
;
}
}
...
...
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