Bug #1909 Sub-queries returning erroneus information
Submitted: 21 Nov 2003 9:28 Modified: 21 Nov 2003 9:49
Reporter: Joao Santos Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.0-alpha OS:Linux (Linux/Intel)
Assigned to: CPU Architecture:Any

[21 Nov 2003 9:28] Joao Santos
Description:
The server returns erroneus results for sub-queries with string conditions.

How to repeat:
create table blah (id int(5) not null auto_increment, buh varchar(4) not null, primary key (id));
insert into blah set buh = 'str1';
insert into blah set buh = 'str2';
insert into blah set buh = 'str2';
insert into blah set buh = 'str3';
insert into blah set buh = 'str3';
insert into blah set buh = 'str3';
select c1, c2, c3 from (select count(*) as c1 from blah where buh = 'str1') as q1, (select count(*) as c2 from blah where buh = 'str2') as q2, (select count(*) as c3 from blah where buh = 'str3') as q3;
select count(*) as c1 from blah where buh = 'str1';
select count(*) as c2 from blah where buh = 'str2';
select count(*) as c3 from blah where buh = 'str3';

Suggested fix:
I shall provide a patch later if I figure out where the bug is and how to fix it myself.  Meanwhile I'll keep by reading the source and getting used to it.
[21 Nov 2003 9:49] Dean Ellis
This issue has already been corrected in 4.1.1, which is available from our daily snapshots and our BitKeeper source repository.

Thank you.