Bug #84416 MySQL updates 0000-00-00 00:00:00 for datetime type
Submitted: 4 Jan 2017 23:11 Modified: 5 Jan 2017 6:38
Reporter: Harish Naik Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.6 and 5.7 OS:Any
Assigned to: CPU Architecture:Any

[4 Jan 2017 23:11] Harish Naik
Description:
Hi,

 The problem is we get zeros inserted in datetime columns upon update.
 

How to repeat:

 Steps to replicate - 

 create table date_time_test(datecol datetime);

 insert into date_time_test values('2017-01-05 03:54:42');

 mysql> select * from date_time_test;
 +---------------------+
 | datecol             |
 +---------------------+
 | 2017-01-05 03:54:42 |
 +---------------------+ 

 mysql> update date_time_test set datecol = datecol = '2017-01-05';
 
 mysql> select * from date_time_test;
 +---------------------+
 | datecol             |
 +---------------------+
 | 0000-00-00 00:00:00 |
 +---------------------+

Suggested fix:
 Kindly fix it as a=b=c because the above logic does not seem to work as a=b=c and expected in any programming language or it should occur as a syntax error if MySQL does no support it i think. Correct me if my thinking is wrong.
 
 Thanks,
 Harish Naik
[5 Jan 2017 6:38] MySQL Verification Team
Thank you for the report.