VERSION I'm using Server version: 5.1.36-community-log MySQL Community Server (GPL)
I've finally contrived a easy example to reproduce it easily!
setup:
create table t1(id integer unsigned,link integer unsigned);
create table t2(id integer unsigned auto_increment,primary key(id));
create table t3(id integer unsigned,content varchar(30));
insert into t1 value(1,null);
insert into t2 value(1);
insert into t3 value(1,'test');
then run:
select t2.*,t3.*
from t1
left join t2 on t1.link=t2.id
left join t3 on t3.id=t2.id
where t1.id=1;
will get this wrongly:
+------+------+---------+
| id | id | content |
+------+------+---------+
| NULL | 1 | test |
+------+------+---------+
But if we create t2 this way,it won't happen:
create table t2(id integer unsigned);
So,it has something to do with primary key!
NEW FOUND
run this will not trigger the bug:
select t2.*,t3.*
from t1
left join t2 on t1.link=t2.id
left join t3 on t2.id=t3.id
where t1.id=1;
So it also has something to do with join direction!