0

I try the following alter table:
ALTER TABLE test MODIFY COLUMN a timestamp NULL DEFAULT '1970-01-01 00:00:01';

The table structure is:

CREATE TABLE `test` (
 `a` timestamp NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8

My sql_mode is:

STRICT_TRANS_TABLES,
NO_ZERO_IN_DATE,
NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO,
NO_AUTO_CREATE_USER,
NO_ENGINE_SUBSTITUTION

The error I get is : #1067 - Unknown error 1067 Other thing that baffles me, why it doesn't show the actual error?

Ravi
  • 30,829
  • 42
  • 119
  • 173
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
  • I think it's because it's a timestamp. A timestamp default value is NOW(). Try changing it to a DATETIME with a default. – flip Jan 30 '18 at 14:56

1 Answers1

0

It seems, your server has ALLOW_INVALID_DATES disabled.

The server requires that month and day values be legal, and not merely in the range 1 to 12 and 1 to 31, respectively. With strict mode disabled, invalid dates such as '2004-04-31' are converted to '0000-00-00' and a warning is generated. With strict mode enabled, invalid dates generate an error. To permit such dates, enable ALLOW_INVALID_DATES

Ravi
  • 30,829
  • 42
  • 119
  • 173