Reputation: 26418
I am trying to create a table in mysql database by running below query,
CREATE TABLE vms_schedule(
schedule_id Int AUTO_INCREMENT
, name varchar(255) NOT NULL
, start_date timestamp NOT NULL
, end_date timestamp NOT NULL
, sun Numeric(10, 0)
, mon Numeric(10, 0)
, tue Numeric(10, 0)
, wed Numeric(10, 0)
, thu Numeric(10, 0)
, fri Numeric(10, 0)
, sat Numeric(10, 0)
,PRIMARY KEY (schedule_id)
);
But I am getting "Invalid default value for end_date" error. Not sure what is wrong with the query as it works for start_date and not for end_date.
EDIT:
Thanks.
Upvotes: 1
Views: 310
Reputation: 164679
I cannot reproduce this problem on MySQL 5.6.23. I don't have MySQL 5.7. 5.7 is a development release. You probably shouldn't be using it for production. You probably hit a bug and you should report it.
I would avoid TIMESTAMP and use DATETIME instead. TIMESTAMP has many odd and confusing "features" and is limited to dates between 1970 and 2038. Its simpler and more robust to use DATETIME and declare any magic you want to happen explicitly.
Upvotes: 2