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
>anywhere.
>
>--Michael
Michael,
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 6.5.3.1 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
columns.
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
it saves
space and makes table operations faster.
Mike
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php