Bug #35 Min function might return NULL for columns containing null and non-null values
Submitted: 23 Jan 2003 18:26 Modified: 15 Feb 2003 23:37
Reporter: Igor Babaev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.23 OS:Any (any)
Assigned to: Igor Babaev CPU Architecture:Any

[23 Jan 2003 18:26] Igor Babaev
Description:
Min aggregate function might return null value for columns than contain both
null and non-null values if there is an index(key) for this column.
Min must always return minimal non-null value.

How to repeat:
create table t1(a1 int, a2 char(3), key k1(a1), key k2(a2));
insert into t1 values(10,'aaa'); 
insert into t1 values(10,null);
insert into t1 values(10,'bbb');
insert into t1 values(20,'zzz'); 

select min(a2) from t1;
[15 Feb 2003 23:37] Michael Widenius
Fixed in 4.0.11;  Is not likely to be fixed in 3.23 as this is not a 
critical bug.