Bug #69714 | Inconsistent DATETIME conversions with fractional seconds | ||
---|---|---|---|
Submitted: | 10 Jul 2013 16:42 | Modified: | 27 Mar 2014 21:21 |
Reporter: | Todd Farmer (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.6.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[10 Jul 2013 16:42]
Todd Farmer
[10 Jul 2013 17:13]
Todd Farmer
Further documentation rendered incompatible with 5.6 behavior: " Values specified as numbers should be 6, 8, 12, or 14 digits long. If a number is 8 or 14 digits long, it is assumed to be in YYYYMMDD or YYYYMMDDHHMMSS format and that the year is given by the first 4 digits. If the number is 6 or 12 digits long, it is assumed to be in YYMMDD or YYMMDDHHMMSS format and that the year is given by the first 2 digits. Numbers that are not one of these lengths are interpreted as though padded with leading zeros to the closest length. Values specified as nondelimited strings are interpreted according their length. For a string 8 or 14 characters long, the year is assumed to be given by the first 4 characters. Otherwise, the year is assumed to be given by the first 2 characters. The string is interpreted from left to right to find year, month, day, hour, minute, and second values, for as many parts as are present in the string."
[10 Jul 2013 17:33]
Todd Farmer
I think that introducing fractional second support without delimiters is problematic and will lead to ambiguous behavior. For example: mysql> SELECT TIMESTAMP '1307100102031234'; +------------------------------+ | TIMESTAMP '1307100102031234' | +------------------------------+ | 1307-10-01 02:03:12.34 | +------------------------------+ 1 row in set (0.00 sec) The above could easily be meant to be parsed as "13-07-10T01:02:03.1234". I suggest that fractional seconds *always* require a delimiter (either period or comma, neither of which should be allowed as delimiters elsewhere). The parsing of the non-fractional components should align with existing documented behavior.
[27 Mar 2014 21:21]
Paul DuBois
Noted in 5.6.17, 5.7.4 changelogs. A temporal literal string without delimiters and more than 14 digits was validated as a TIMESTAMP/DATETIME value with a two-digit precision fractional seconds part. But fractional seconds should always be separated from other parts of a time by a decimal point.
[29 Mar 2014 8:19]
Laurynas Biveinis
5.6$ bzr log -r 5830 ------------------------------------------------------------ revno: 5830 committer: mithun <mithun.c.y@oracle.com> branch nick: mysql-5.6 timestamp: Thu 2014-02-20 16:59:59 +0530 message: Bug #17080703: INCONSISTENT DATETIME CONVERSIONS WITH FRACTIONAL SECONDS ISSUE : ------- A temporal literal string without delimiters and having > 14 digits was validated as a TIMESTAMP/DATETIME value with two digit precision fractional seconds. For example, a 16 digit string 'xxxxxxxxxxxxxxxx' is interpreted as 'XXXX-XX-XX XX:XX:XX.xx'. But fractional seconds should always be separated from other parts of time. And, decimal point is the only delimiter which separates the fractional seconds from rest. SOLUTION : ---------- Reject all time typed strings where the fractional seconds are not separated by a decimal point.