Bug #7101 Usage of LEFT() function in GROUP BY crashes a server
Submitted: 8 Dec 2004 12:19 Modified: 10 Dec 2004 11:29
Reporter: SINISA MILIVOJEVIC Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Any (all)
Assigned to: CPU Architecture:Any

[8 Dec 2004 12:19] SINISA MILIVOJEVIC
When a query uses LEFT() column that is also making , entirely or partially, a field by which the entire query is aggregating with GROUP BY, that cases a crash.

How to repeat:
drop table if exists t1;
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom',now()),(2,'ball games',now()), (3,'Basil',now()), (4,'Dean',now()),(5,'Ellis',now()), (6,'Serg',now()), (7,'Sergei',now()),(8,'Georg',now()),(9,'Salle',now()),(10,'Sinisa',now()); 
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table if exists t1;
[9 Dec 2004 23:00] Sergei Golubchik
fixed in 4.1.9
[10 Dec 2004 11:29] MySQL Verification Team
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

Changeset 1.2144