GNU Info

Info Node: (mysql.info)Silent column changes

(mysql.info)Silent column changes


Prev: CREATE TABLE Up: CREATE TABLE
Enter node , (file) or (file)node

Silent Column Specification Changes
...................................

In some cases, MySQL silently changes a column specification from that
given in a `CREATE TABLE' statement.  (This may also occur with `ALTER
TABLE'.):

   * `VARCHAR' columns with a length less than four are changed to
     `CHAR'.

   * 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.  Note: Table types.

   * `TIMESTAMP' display sizes must be even and in the range from 2 to
     14.  If you specify a display size of 0 or greater than 14, the
     size is coerced to 14.  Odd-valued sizes in the range from 1 to 13
     are coerced to the next higher even number.

   * You cannot store a literal `NULL' in a `TIMESTAMP' column; setting
     it to `NULL' sets it to the current date and time.  Because
     `TIMESTAMP' columns behave this way, the `NULL' and `NOT NULL'
     attributes do not apply in the normal way and are ignored if you
     specify them.  `DESCRIBE tbl_name' always reports that a
     `TIMESTAMP' column may be assigned `NULL' values.

   * MySQL maps certain column types used by other SQL database vendors
     to MySQL types.  Note: Other-vendor column types.

If you want to see whether or not MySQL used a column type other than
the one you specified, issue a `DESCRIBE tbl_name' statement after
creating or altering your table.

Certain other column type changes may occur if you compress a table
using `myisampack'. Note: Compressed format.


automatically generated by info2www version 1.2.2.9