List:Internals« Previous MessageNext Message »
From:eugene Date:October 13 2005 11:22pm
Subject:bk commit into 4.0 tree (evgen:1.2165) BUG#13855
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2165 05/10/14 01:22:24 evgen@stripped +3 -0
  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.

  mysql-test/t/select.test
    1.30 05/10/14 01:21:52 evgen@stripped +9 -0
     Test case for bug#13855 select distinct with group by caused server crash

  mysql-test/r/select.result
    1.40 05/10/14 01:21:24 evgen@stripped +8 -0
    Test case for bug#13855 select distinct with group by caused server crash

  sql/sql_select.cc
    1.293 05/10/14 01:20:33 evgen@stripped +1 -0
    Fix bug #13855 select distinct with group by caused server crash

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/work/13855-bug-4.0-mysql

--- 1.292/sql/sql_select.cc	2005-10-13 18:23:37 +04:00
+++ 1.293/sql/sql_select.cc	2005-10-14 01:20:33 +04:00
@@ -626,6 +626,7 @@
   {
     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);

--- 1.39/mysql-test/r/select.result	2005-10-13 18:23:37 +04:00
+++ 1.40/mysql-test/r/select.result	2005-10-14 01:21:24 +04:00
@@ -2477,3 +2477,11 @@
 1	2	2	1
 1	2	3	1
 DROP TABLE IF EXISTS t1, t2;
+create table t1 (f1 int primary key, f2 int);
+create table t2 (f3 int, f4 int, primary key(f3,f4));
+insert into t1 values (1,1);
+insert into t2 values (1,1),(1,2);
+select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
+count(f2) >0
+1
+drop table t1,t2;

--- 1.29/mysql-test/t/select.test	2005-10-13 18:23:37 +04:00
+++ 1.30/mysql-test/t/select.test	2005-10-14 01:21:52 +04:00
@@ -2013,3 +2013,12 @@
 WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
 DROP TABLE IF EXISTS t1, t2;
 
+#
+# Bug #13855 select distinct with group by caused server crash
+#
+create table t1 (f1 int primary key, f2 int);
+create table t2 (f3 int, f4 int, primary key(f3,f4));
+insert into t1 values (1,1);
+insert into t2 values (1,1),(1,2);
+select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
+drop table t1,t2;
Thread
bk commit into 4.0 tree (evgen:1.2165) BUG#13855eugene13 Oct