Crome Bash
Crome Bash

Reputation: 15

Mariadb alter table column data type error, wrong column

I am having a bit of a problem with mariadb with the following query

ALTER TABLE archive_maindata CHANGE monthly_income monthly_income decimal(25,4) DEFAULT '0.0000';

but I got this error,

Additional information: Incorrect date value: '0000-00-00' for column 'expiry_date' at row 3'

I can't figure out what it is that I am doing wrong, I am not trying to change the expire_date column as you can see in the query. Any help would be appreciated Thanks in advance

Upvotes: 0

Views: 355

Answers (1)

Dave
Dave

Reputation: 5191

Sounds like you updated MariaDB at some point and the default SQL_MODE in the later version defaults to STRICT_TRANS_TABLES which will disallow a date/time that is all zeros. The default changed with MariaDB 10.2.4.

You need to either fix the dates so they are valid or change the SQL_MODE to disable STRICT_TRANS_TABLES. The error you are getting is MariaDB trying to help you by warning you that you have data that is not valid.

Upvotes: 1

Related Questions