From 0390de8672255aed7d35734fa8bc0d87efbe532e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 14 Oct 2005 01:22:24 +0400 Subject: 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 --- sql/sql_select.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_select.cc') diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7c2c233d754..46f0139a608 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -626,6 +626,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &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); -- cgit v1.2.1