List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:July 10 2002 3:33am
Subject:Re: Char type changes to Varchar type
View as plain text  
In the last episode (Jul 09), Michael Ivanyo said:
> 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.

  * 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 affect how you use the columns in any way; in MySQL,
    VARCHAR is just a different way to store characters. MySQL performs
    this conversion because it saves space and makes table operations
    faster. See section 7 MySQL Table Types.

	Dan Nelson
Char type changes to Varchar typeMichael Ivanyo10 Jul
  • Re: Char type changes to Varchar typeDan Nelson10 Jul
  • Re: Char type changes to Varchar typemos10 Jul