Hi,
I'm trying to create a table with a timestamp field, which doesn't allow null (insert with null should fail). Could someone help, please?
mysql> select @@version;
5.6.24-ndb-7.4.6-cluster-gpl
mysql> SELECT @@sql_mode;
STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
mysql> SELECT @@explicit_defaults_for_timestamp;
1
CREATE TABLE `test` (
`id` int(10) unsigned auto_increment,
`startTime` timestamp NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=ndb;
ERROR 1067 (42000): Invalid default value for 'startTime'
Result is the same for innodb engine.
Documentation states:
https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp
"TIMESTAMP columns declared as NOT NULL and without an explicit DEFAULT clause are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs."
So what am I missing here?