Description:
As of MySQL 5.0.2, for columns that are NOT NULL and that
do not include an explicit DEFAULT clause, MySQL adds no
DEFAULT clause to the column definition:
mysql> create table t (i int not null);
Query OK, 0 rows affected (0.40 sec)
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`i` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
However, ENUM is not consistent with that change. A DEFAULT
clause is added even if the column definition does not include one:
mysql> create table t (e enum('a','b','c') NOT NULL);
Query OK, 0 rows affected (0.44 sec)
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`e` enum('a','b','c') NOT NULL default 'a'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.01 sec)
How to repeat:
See above.
Description: As of MySQL 5.0.2, for columns that are NOT NULL and that do not include an explicit DEFAULT clause, MySQL adds no DEFAULT clause to the column definition: mysql> create table t (i int not null); Query OK, 0 rows affected (0.40 sec) mysql> show create table t\G *************************** 1. row *************************** Table: t Create Table: CREATE TABLE `t` ( `i` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 However, ENUM is not consistent with that change. A DEFAULT clause is added even if the column definition does not include one: mysql> create table t (e enum('a','b','c') NOT NULL); Query OK, 0 rows affected (0.44 sec) mysql> show create table t\G *************************** 1. row *************************** Table: t Create Table: CREATE TABLE `t` ( `e` enum('a','b','c') NOT NULL default 'a' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 1 row in set (0.01 sec) How to repeat: See above.