pt-osc is not run with column that default value is 0000-00-00 00:00:00
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Expired
|
Undecided
|
Unassigned |
Bug Description
mysql version : 5.6.25
tool version : percona-
- i want add column with pt-osc.
- command : ./bin/pt-
But error is occur like that :
Error creating new table: DBD::mysql::db do failed: Invalid default value for 'CREATE_DT' [for Statement "CREATE TABLE `idb`.`
`ERR_CD` varchar(5) COLLATE utf8mb4_bin NOT NULL,
`ERR_MSG` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`USE_FG` varchar(1) COLLATE utf8mb4_bin DEFAULT 'N',
`START_DT` timestamp NULL DEFAULT NULL,
`END_DT` timestamp NULL DEFAULT NULL,
`CREATE_DT` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`MODIFY_DT` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ERR_CD`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=
- the default value of 'CREATE_DT' is '0000-00-00 00:00:00'. is it problem for using pt-osc?
please check and answer.
thanks
tags: | added: pt-online-schema-change |
Hi almaz,
It's a problem with MySQL sql_mode variable.
Check the modes like this:
show variables like 'sql_mode';
You probably have a combination of STRICT_ALL_TABLES, NO_ZERO_ DATE,NO_ ZERO_IN_ DATE or something of the sort.
You have to either remove those modes (set global sql_mode = ... ) , or use a valid date for timestamp.
See: http:// dev.mysql. com/doc/ refman/ 5.6/en/ sql-mode. html