diff options
author | unknown <timour@mysql.com> | 2005-09-30 10:39:17 +0300 |
---|---|---|
committer | unknown <timour@mysql.com> | 2005-09-30 10:39:17 +0300 |
commit | 68a91293ebced766717bb2d602f4fdaa21e94bef (patch) | |
tree | cf60ca955291df1e3cd5b1f770e6ef55491d1c98 /mysql-test/t/select.test | |
parent | 3a806cd674deca9288f7555c03172afa4ada01ac (diff) | |
download | mariadb-git-68a91293ebced766717bb2d602f4fdaa21e94bef.tar.gz |
Fix for BUG#13597 - columns in ON condition not resolved if references a table in a nested right join.
The problem was in that when finding the last table reference in a nested join tree,
the procedure doing the iteration over the right-most branches of a join tree
was testing for RIGHT JOINs the table reference that represents the join, and not
the second operand of the JOIN. Currently the information whether a join is LEFT/RIGHT
is stored not on the join object itself, but on one of its operands.
mysql-test/r/select.result:
Added test for BUG#13597
mysql-test/t/select.test:
Added test for BUG#13597
sql/table.cc:
- test whether a table reference is a right join by testing the
rigth join operand (first in the list of operands), and not
the table reference that represents the join itself.
- clearer comments
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r-- | mysql-test/t/select.test | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index f6f08eeb492..f7de7239292 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2575,3 +2575,37 @@ select * from v1 left join v3 using (id); drop table t1, t2; 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; |