mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix bug #13855 select distinct with group by caused server crash
DISTINCT wasn't optimized away and caused creation of tmp table in wrong case. This result in integer overrun and running out of memory. Fix backported from 4.1. Now if optimizer founds that in result be only 1 row it removes distinct. sql/sql_select.cc: Fix bug #13855 select distinct with group by caused server crash mysql-test/r/select.result: Test case for bug#13855 select distinct with group by caused server crash mysql-test/t/select.test: Test case for bug#13855 select distinct with group by caused server crash
This commit is contained in:
@@ -626,6 +626,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
|
||||
{
|
||||
order=0; // The output has only one row
|
||||
simple_order=1;
|
||||
select_distinct= 0; // No need in distinct for 1 row
|
||||
}
|
||||
|
||||
calc_group_buffer(&join,group);
|
||||
|
||||
Reference in New Issue
Block a user