Bug #701 Table converted from 4.0 to 4.1 has wrong properties
Submitted: 23 Jun 2003 12:03 Modified: 28 Jul 2003 5:19
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:Any (All)
Assigned to: Sergei Golubchik CPU Architecture:Any

[23 Jun 2003 12:03] Peter Zaitsev
Description:
If table was created by MySQL before version 4.1 it is represented 
in MySQL 4.1 as each column has its own charset instead of single one per whole table.  This results in very annoying situation what you can't convert such
table to unicode or other charset with simple alter table ... charset=xxx;

This is important as it is common migration procedure users follow migrating their table in MySQL 4.1 to different charset (usually unicode)

Note it is also in a way if I use the same (without charset) create statement
in MySQL 4.1 I get the charset mapped to the table and not to the its columns.
This results what dumping table in MySQL 4.0 and loading it to 4.1 results in
different table structure than done by file copying. 

How to repeat:
MySQL 4.0:

mysql> create table tst(c char(20));
Query OK, 0 rows affected (0.08 sec)

mysql> show create table tst;
+-------+----------------------------------------------------------------+
| Table | Create Table                                                   |
+-------+----------------------------------------------------------------+
| tst   | CREATE TABLE `tst` (
  `c` char(20) default NULL
) TYPE=MyISAM |
+-------+----------------------------------------------------------------+
1 row in set (0.02 sec)

MySQL 4.1:

mysql> show create table tst;
+-------+-------------------------------------------------------------------------------------+
| Table | Create Table                                                                        |
+-------+-------------------------------------------------------------------------------------+
| tst   | CREATE TABLE `tst` (
  `c` char(20) character set latin1 default NULL
) TYPE=MyISAM |
+-------+-------------------------------------------------------------------------------------+
1 row in set (0.04 sec)

mysql> create table tst2(c char(20));
Query OK, 0 rows affected (0.05 sec)

mysql> show create table tst2;
+-------+--------------------------------------------------------------------------------+
| Table | Create Table                                                                   |
+-------+--------------------------------------------------------------------------------+
| tst2  | CREATE TABLE `tst2` (
  `c` char(20) default NULL
) TYPE=MyISAM CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Suggested fix:
Fix old table format reader to treat charset set for whole table rather
than each of the fields. This is OK as it shall be same for whole fields
anyway.
[28 Jul 2003 5:19] Sergei Golubchik
fixed in 4.1.1