At 10:19 PM 7/9/2002, you wrote:
>I am using MySql with InnoDB and have just discovered
>that tables created using char types show up as
>varchars when I type, describe tableName. Previously,
>I was using MyIsam tables and did not see char types
>being changed to varchars so I am a bit puzzled.
>This is true for almost all of the tables I've
>created, only a couple of tables retained the char
>type as specified in my create table script.
>Is this documented behavior? I haven't been using
>MySql very long and haven't seen it mentioned
Do not panic, this is normal for MySQL. If you have at least one
VarChar field in your table, then they will all be set to VarChar. If you
want to change them back to Char(x), then you need to change them all at
once using a single Alter Table command. You could also try MySQLFront or
MySqlMgr. See section 126.96.36.199 Silent Column Specication Changes.
Here is an excerpt from the manual:
If any column in a table has a variable length, the entire row is
variable-length as a
result. Therefore, if a table contains any variable-length columns
(VARCHAR, TEXT, or
BLOB), all CHAR columns longer than three characters are changed to VARCHAR
This doesn't aect how you use the columns in any way; in MySQL, VARCHAR is just
a dierent way to store characters. MySQL performs this conversion because
space and makes table operations faster.