At 12:08 PM -0500 4/20/99, efrazier@stripped wrote:
>Hi,
>
>A while ago when asking about ALTER TABLE I was told that changing a field
>from char to varchar will result in the other chars in that table being
>converted to varchars, which it certainly seemed to have done, but when the
>table was made that way in the first place it at least looks like it is
>allowed. I just noticed I have a table that has varchar and chars at the
>same time. I thought this was not possible?
>
>mysql> explain Section_numbers;
>+---------+--------------+------+-----+---------+-------+
>| Field | Type | Null | Key | Default | Extra |
>+---------+--------------+------+-----+---------+-------+
>| Chapter | char(3) | YES | | NULL | |
>| Section | smallint(6) | | PRI | 0 | |
>| Name | varchar(100) | | MUL | | |
>| Type | char(3) | | MUL | | |
>+---------+--------------+------+-----+---------+-------+
There is a section in the manual that discusses when these CHAR->VARCHAR
conversions take place:
http://www.mysql.com/Manual_chapter/manual_Reference.html#Silent_column_changes
As part of that section notes:
VARCHAR columns with a length less than four are changed to CHAR.
(The reason is that for short fields there is no storage benefit
to be gained by using VARCHAR.)
--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/