List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:December 9 2008 1:39pm
Subject:bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2740)
Bug#31291
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.0-bugteam/ based on
revid:sergey.glukhov@stripped

 2740 Sergey Glukhov	2008-12-09
      Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
      added ability for TINY[MEDIUM] text fields 
      to be converted to greater subtype during
      alter if necessary(altered charset)
modified:
  mysql-test/r/alter_table.result
  mysql-test/t/alter_table.test
  sql/sql_table.cc

per-file messages:
  mysql-test/r/alter_table.result
    test result
  mysql-test/t/alter_table.test
    test case
  sql/sql_table.cc
    added ability for TINY[MEDIUM] text fields 
    to be converted to greater subtype during
    alter if necessary(altered charset)
=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result	2007-09-20 08:54:46 +0000
+++ b/mysql-test/r/alter_table.result	2008-12-09 12:38:52 +0000
@@ -915,3 +915,19 @@ check table t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 drop table t1;
+create table t1 (a tinytext character set latin1);
+alter table t1 convert to character set utf8;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` text
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+drop table t1;
+create table t1 (a mediumtext character set latin1);
+alter table t1 convert to character set utf8;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+drop table t1;

=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test	2007-07-27 09:30:25 +0000
+++ b/mysql-test/t/alter_table.test	2008-12-09 12:38:52 +0000
@@ -696,3 +696,16 @@ unlock tables;
 select * from t1;
 check table t1;
 drop table t1;
+
+
+#
+# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
+#
+create table t1 (a tinytext character set latin1);
+alter table t1 convert to character set utf8;
+show create table t1;
+drop table t1;
+create table t1 (a mediumtext character set latin1);
+alter table t1 convert to character set utf8;
+show create table t1;
+drop table t1;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-11-13 13:06:48 +0000
+++ b/sql/sql_table.cc	2008-12-09 12:38:52 +0000
@@ -1535,7 +1535,9 @@ static bool prepare_blob_field(THD *thd,
     
   if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
   {
-    if (sql_field->sql_type == FIELD_TYPE_BLOB)
+    if (sql_field->sql_type == FIELD_TYPE_BLOB ||
+        sql_field->sql_type == FIELD_TYPE_TINY_BLOB ||
+        sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB)
     {
       /* The user has given a length to the blob column */
       sql_field->sql_type= get_blob_type_from_length(sql_field->length);

Thread
bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2740)Bug#31291Sergey Glukhov9 Dec