Out of range value datetime when insert from select
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Expired
|
Undecided
|
Unassigned |
Bug Description
Stack trace:
PerconaMigrator
2017-02-17T05:38:42 Error copying rows from `bingo`.`contracts` to `bingo`
Level: Warning
Code: 1264
Message: Out of range value for column 'end_date' at row 2127
Query: INSERT LOW_PRIORITY IGNORE INTO `bingo`
OK, lets understand whats happens - firstly, a little schema:
(ruby app) -> (percona migrator gem) -> (pt-online-
All queries from app percona migrator gem converting to pt-online-
First source query looks like ALTER TABLE ..... converting to console command like $ pt-online-
This query works good with pt-online-
Examples:
==> Query with fail:
INSERT LOW_PRIORITY IGNORE INTO `table`.`_name_new` (`id`, `name`, `number`, `version`, `supplier_id`, `start_date` ... ) SELECT `id`, `name`, `number`, `version`, `supplier_id`, `start_date` ... FROM `table`.`name` FORCE INDEX(`PRIMARY`) WHERE ((`id` >= ?)) AND ((`id` <= ?)) LOCK IN SHARE MODE
==> Query without fail:
INSERT LOW_PRIORITY IGNORE INTO `table`.`_name_new` (`id`, `name`, `number`, `version`, `supplier_id`, `start_date` ... ) SELECT `id`, `name`, `number`, `version`, `supplier_id`, CAST(`start_date` AS DATE) ... FROM `table`.`name` FORCE INDEX(`PRIMARY`) WHERE ((`id` >= ?)) AND ((`id` <= ?)) LOCK IN SHARE MODE
But we can't do it because of this query generates by pt-online-
Related link - http://
Possible patch to oesolve this issue