| Bug #6267 | ENUM ... NOT NULL w/o default treated differently than other data types | ||
|---|---|---|---|
| Submitted: | 26 Oct 2004 17:24 | Modified: | 19 May 2005 0:41 |
| Reporter: | Paul DuBois | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.2-alpha-debug | OS: | |
| Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[18 May 2005 9:38]
Ramil Kalimullin
Fixed in 5.0.7
[19 May 2005 0:41]
Paul DuBois
Noted in 5.0.7 changelog.

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.