Bug #84082 JSON_OBJECT("k", dateTime) adds milliseconds to time
Submitted: 6 Dec 2016 19:01 Modified: 8 Dec 2016 23:03
Reporter: enzo mdd Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:5.7.14-google-log OS:Any
Assigned to: CPU Architecture:Any
Tags: datetime, JSON_OBJECT

[6 Dec 2016 19:01] enzo mdd
Description:
SELECT JSON_OBJECT("k", cast("2016-11-19 17:46:31" as datetime(0)))
{"k": "2016-11-19 17:46:31.000000"}

How to repeat:
SELECT JSON_OBJECT("k", cast("2016-11-19 17:46:31" as datetime(0)))
{"k": "2016-11-19 17:46:31.000000"}

Suggested fix:
Do not re parse date values when creating JSON objects.
[8 Dec 2016 23:03] MySQL Verification Team
Thank you for the bug report.

mysql 5.7 > SELECT JSON_OBJECT("k", cast("2016-11-19 17:46:31" as datetime(0)));
+--------------------------------------------------------------+
| JSON_OBJECT("k", cast("2016-11-19 17:46:31" as datetime(0))) |
+--------------------------------------------------------------+
| {"k": "2016-11-19 17:46:31.000000"}                          |
+--------------------------------------------------------------+
1 row in set (0.08 sec)

mysql 5.7 > show variables like "%version%";
+-------------------------+---------------------------------------+
| Variable_name           | Value                                 |
+-------------------------+---------------------------------------+
| innodb_version          | 5.7.18                                |
| protocol_version        | 10                                    |
| slave_type_conversions  |                                       |
| tls_version             | TLSv1,TLSv1.1                         |
| version                 | 5.7.18                                |
| version_comment         | Source distribution PULL: 2016-NOV-20 |
| version_compile_machine | x86_64                                |
| version_compile_os      | Win64                                 |
+-------------------------+---------------------------------------+
8 rows in set (0.00 sec)