List:Commits« Previous MessageNext Message »
From:gluh Date:February 21 2006 8:24am
Subject:bk commit into 5.1 tree (gluh:1.2144) BUG#14367
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh 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.2144 06/02/21 12:23:48 gluh@stripped +4 -0
  Bug#14367 Partitions: crash if utf8 column
  use part_info->item_free_list instead of thd->free_list during partition function parsing 

  sql/sql_partition.cc
    1.38 06/02/21 12:21:59 gluh@stripped +3 -0
    Bug#14367 Partitions: crash if utf8 column
    use part_info->item_free_list instead of thd->free_list during partition function parsing

  sql/item.cc
    1.170 06/02/21 12:21:59 gluh@stripped +4 -1
    Bug#14367 Partitions: crash if utf8 column
      create copy of string in current mem_root to avoid memory leak

  mysql-test/t/partition.test
    1.17 06/02/21 12:21:59 gluh@stripped +9 -0
    Bug#14367 Partitions: crash if utf8 column
      test case

  mysql-test/r/partition.result
    1.13 06/02/21 12:21:59 gluh@stripped +5 -0
    Bug#14367 Partitions: crash if utf8 column
      test case

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.1.14367

--- 1.169/sql/item.cc	Fri Feb 17 22:56:36 2006
+++ 1.170/sql/item.cc	Tue Feb 21 12:21:59 2006
@@ -650,6 +650,7 @@ Item *Item_string::safe_charset_converte
 {
   Item_string *conv;
   uint conv_errors;
+  char *ptr;
   String tmp, cstr, *ostr= val_str(&tmp);
   cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
   if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
@@ -664,7 +665,9 @@ Item *Item_string::safe_charset_converte
     */
     return NULL;
   }
-  conv->str_value.copy();
+  if (!(ptr= current_thd->memdup(cstr.ptr(), cstr.length() + 1 )))
+    return NULL;
+  conv->str_value.set(ptr, cstr.length(), cstr.charset());
   /* Ensure that no one is going to change the result string */
   conv->str_value.mark_as_const();
   return conv;

--- 1.12/mysql-test/r/partition.result	Fri Feb 17 23:06:00 2006
+++ 1.13/mysql-test/r/partition.result	Tue Feb 21 12:21:59 2006
@@ -315,4 +315,9 @@ drop table t1;
 create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
 alter table t1 add partition (partition x3 values in (30));
 drop table t1;
+create table t1 (s1 char(2) character set utf8)
+partition by list (case when s1 > 'cz' then 1 else 2 end)
+(partition p1 values in (1),
+partition p2 values in (2));
+drop table t1;
 End of 5.1 tests

--- 1.16/mysql-test/t/partition.test	Thu Feb 16 20:15:32 2006
+++ 1.17/mysql-test/t/partition.test	Tue Feb 21 12:21:59 2006
@@ -408,4 +408,13 @@ create table t1 (s1 int, unique (s1)) pa
 alter table t1 add partition (partition x3 values in (30));
 drop table t1;
 
+#
+# Bug#14367: Partitions: crash if utf8 column
+#
+create table t1 (s1 char(2) character set utf8)
+partition by list (case when s1 > 'cz' then 1 else 2 end)
+(partition p1 values in (1),
+ partition p2 values in (2));
+drop table t1;
+
 --echo End of 5.1 tests

--- 1.37/sql/sql_partition.cc	Wed Feb 15 15:52:22 2006
+++ 1.38/sql/sql_partition.cc	Tue Feb 21 12:21:59 2006
@@ -1977,6 +1977,7 @@ bool fix_partition_func(THD *thd, const 
   char* db_name;
   partition_info *part_info= table->part_info;
   ulong save_set_query_id= thd->set_query_id;
+  Item *thd_free_list= thd->free_list;
   DBUG_ENTER("fix_partition_func");
 
   if (part_info->fixed)
@@ -2011,6 +2012,7 @@ bool fix_partition_func(THD *thd, const 
       DBUG_RETURN(TRUE);
     }
   }
+  thd->free_list= part_info->item_free_list;
   if (is_sub_partitioned(part_info))
   {
     DBUG_ASSERT(part_info->subpart_type == HASH_PARTITION);
@@ -2120,6 +2122,7 @@ bool fix_partition_func(THD *thd, const 
   set_up_range_analysis_info(part_info);
   result= FALSE;
 end:
+  thd->free_list= thd_free_list;
   thd->set_query_id= save_set_query_id;
   DBUG_PRINT("info", ("thd->set_query_id: %d", thd->set_query_id));
   DBUG_RETURN(result);
Thread
bk commit into 5.1 tree (gluh:1.2144) BUG#14367gluh21 Feb