Bug #1318 incorrect handling of aggregate functions in static tables
Submitted: 17 Sep 2003 1:39 Modified: 7 Oct 2003 22:55
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[17 Sep 2003 1:39] Oleksandr Byelkin
Description:
bug in Item_ref_null_helper of handling reffered item 

How to repeat:
drop table if exists t36,t37; 
create table t36 (s1 char(5) collate latin1_german2_ci); 
insert into t36 values ('?'); 
create table t37 (s1 char(5) collate latin1_german2_ci); 
insert into t37 values ('ue'); 
select * from t37 where s1 = any (select max(s1) from t36); 
select * from t37 where s1 in (select max(s1) from t36); 
select * from t37 where s1 = (select max(s1) from t36); 
drop table t36,t37; 
 

Suggested fix:
create split_sum_func method for Item_ref_null_helper
[18 Sep 2003 1:25] Oleksandr Byelkin
split_sum_func is not cause of error...
[20 Sep 2003 8:05] Oleksandr Byelkin
Problem is not subqueries dependent, most simple test suite is: 
create table t1 (a int); 
insert into t1 values (1); 
select max(a) as b from t1 having b=1; 
select a from t1 having a=1; 
drop table t1;
[20 Sep 2003 8:34] Oleksandr Byelkin
ChangeSet 
  1.1595 03/09/20 18:30:36 bell@laptop.sanja.is.com.ua +4 -0 
  fixed processing aggregate functions with static tables (BUG#1318)