List:Internals« Previous MessageNext Message »
From:eugene Date:May 25 2005 9:35pm
Subject:bk commit into 5.0 tree (evgen:1.1912) BUG#9593
View as plain text  
Below is the list of changes that have just been committed into a local
5.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.1912 05/05/25 23:35:35 evgen@stripped +3 -0
  Fix bug #9593 "The combination of COUNT, DISTINCT and CONCAT seems to lock the
  server"
  Bug appears only on Windows platform. Freeing memory in 
  TMP_TABLE_PARAM::cleanup() allocated by new Copy_fields[0] in 
  setup_copy_fields() results in memory destruction. In test IF used instead 
  of CONCAT because IF have more stable crash.
  

  mysql-test/r/count_distinct.result
    1.9 05/05/25 22:47:57 evgen@stripped +6 -0
    Test case for bug #9593 The combination of COUNT, DISTINCT and CONCAT seems to lock
the server

  mysql-test/t/count_distinct.test
    1.9 05/05/25 22:47:20 evgen@stripped +10 -0
    Test case for bug #9593 The combination of COUNT, DISTINCT and CONCAT seems to lock
the server

  sql/sql_select.cc
    1.325 05/05/25 22:45:48 evgen@stripped +11 -6
    Fix bug #9593 The combination of COUNT, DISTINCT and CONCAT seems to lock the server

# 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/mysql-5.0-bug-9593

--- 1.324/sql/sql_select.cc	2005-05-23 21:01:14 +04:00
+++ 1.325/sql/sql_select.cc	2005-05-25 22:45:48 +04:00
@@ -12317,7 +12317,7 @@
 {
   Item *pos;
   List_iterator_fast<Item> li(all_fields);
-  Copy_field *copy;
+  Copy_field *copy= NULL;
   res_selected_fields.empty();
   res_all_fields.empty();
   List_iterator_fast<Item> itr(res_all_fields);
@@ -12325,7 +12325,8 @@
   uint i, border= all_fields.elements - elements;
   DBUG_ENTER("setup_copy_fields");
 
-  if (!(copy=param->copy_field= new Copy_field[param->field_count]))
+  if (param->field_count && 
+      !(copy=param->copy_field= new Copy_field[param->field_count]))
     goto err2;
 
   param->copy_funcs.empty();
@@ -12364,9 +12365,12 @@
 	char *tmp=(char*) sql_alloc(field->pack_length()+1);
 	if (!tmp)
 	  goto err;
-	copy->set(tmp, item->result_field);
-	item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1);
-	copy++;
+      if (copy)
+      {
+        copy->set(tmp, item->result_field);
+        item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1);
+        copy++;
+      }
       }
     }
     else if ((pos->type() == Item::FUNC_ITEM ||
@@ -12409,7 +12413,8 @@
   DBUG_RETURN(0);
 
  err:
-  delete [] param->copy_field;			// This is never 0
+  if (copy)
+    delete [] param->copy_field;			// This is never 0
   param->copy_field=0;
 err2:
   DBUG_RETURN(TRUE);

--- 1.8/mysql-test/r/count_distinct.result	2004-11-10 13:36:15 +03:00
+++ 1.9/mysql-test/r/count_distinct.result	2005-05-25 22:47:57 +04:00
@@ -60,3 +60,9 @@
 1
 1
 drop table t1;
+create table t1 (f1 int, f2 int);
+insert into t1 values (0,1),(1,2);
+select count(distinct if(f1,3,f2)) from t1;
+count(distinct if(f1,3,f2))
+2
+drop table t1;

--- 1.8/mysql-test/t/count_distinct.test	2004-11-10 13:36:15 +03:00
+++ 1.9/mysql-test/t/count_distinct.test	2005-05-25 22:47:20 +04:00
@@ -63,3 +63,13 @@
 insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
 select count(distinct a) from t1 group by b;
 drop table t1;
+
+#
+# Bug #9593
+# Bug appears only on Windows system
+#
+
+create table t1 (f1 int, f2 int);
+insert into t1 values (0,1),(1,2);
+select count(distinct if(f1,3,f2)) from t1;
+drop table t1;
Thread
bk commit into 5.0 tree (evgen:1.1912) BUG#9593eugene25 May