List:General Discussion« Previous MessageNext Message »
From:Victor Pendleton Date:August 16 2004 10:46pm
Subject:RE: Why "VARCHAR" TO "CHAR" automatically when the length less th
an 4.
View as plain text  
This is described here:
http://dev.mysql.com/doc/mysql/en/Silent_column_changes.html. The table is
created as a fixed table format.

-----Original Message-----
From: Emi Lu
To: mysql@stripped
Sent: 8/16/04 3:20 PM
Subject: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.

Hello all,

I have a questions about "varchar columns" change to "CHAR columns" 
automatically.

When I designed a table t1

create table t1(id varchar(3) not null) in MySQL. After that, we use 
"desc t1" to see the description of table "t1".

The result is the following:
===============================
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | char(3) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+

I did not understand why the varchar(3) is changed to char(3) 
automatically. While if we define a varchar(4) it will not change to 
char(4) automatically. Could somebody help and explain that please?

Thanks a lot!
Emi Lu





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=1
Thread
Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Emi Lu16 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Egor Egorov23 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Martijn Tonies23 Aug
    • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Joseph Cochran24 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Martijn Tonies24 Aug
RE: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Victor Pendleton17 Aug