|
Normally DEFAULT NULL is not allowed for NOT NULL columns:
MariaDB [test]> create table t1 (a int not null default null);
|
ERROR 1067 (42000): Invalid default value for 'a'
|
MariaDB [test]> create table t1 (a int default null primary key);
|
ERROR 1067 (42000): Invalid default value for 'a'
|
But this error condition is not always detected and sometimes DEFAULT NULL is silently ignored:
MariaDB [test]> create table t1 (a int default null, primary key (a));
|
Query OK, 0 rows affected (0.014 sec)
|
|
MariaDB [test]> show create table t1\G
|
*************************** 1. row ***************************
|
Table: t1
|
Create Table: CREATE TABLE `t1` (
|
`a` int(11) NOT NULL,
|
PRIMARY KEY (`a`)
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
1 row in set (0.001 sec)
|
|