Bug #86548 Reordering rows does not work
Submitted: 2 Jun 2017 1:39 Modified: 8 Jun 2017 6:42
Reporter: Shravan Rajinikanth Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper OS:Ubuntu (Server 16.04.2 LTS)
Assigned to: CPU Architecture:Any

[2 Jun 2017 1:39] Shravan Rajinikanth
Description:
Reordering rows results in unexpected error

Executing:
ALTER TABLE `products`.`releases` 
CHANGE COLUMN `release_time` `release_time` DATETIME NOT NULL AFTER `id`;

Operation failed: There was an error while applying the SQL script to the database.
ERROR 1292: Incorrect datetime value: '0000-00-00 00:00:00' for column 'release_time' at row 1
SQL Statement:
ALTER TABLE `products`.`releases` 
CHANGE COLUMN `release_time` `release_time` DATETIME NOT NULL AFTER `id`

How to repeat:
DROP TABLE IF EXISTS `releases`;

CREATE TABLE `releases` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `version_name` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
  `channel` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL,
  `release_time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `releases` VALUES (1,'1.1.1','apple','2015-12-13 08:27:51');

And then try to move `release_time` to position 2 (after `id`).

Suggested fix:
-NA-
[2 Jun 2017 1:40] Shravan Rajinikanth
Added version.
[2 Jun 2017 22:14] Shravan Rajinikanth
Potential duplicate of https://bugs.mysql.com/bug.php?id=77445.

But that one hasn't been fixed for 2 years, so I'm not sure. Some reordering works fine for me, just not this specific combination.
[8 Jun 2017 6:42] MySQL Verification Team
Thank you for the bug report.
This is duplicate of Bug #77445	

Thanks,
Umesh