dolt
dolt copied to clipboard
Support MySQL datetime parsing behavior
MySQL behavior for parsing datetime literals is slightly different from Dolt's current behavior. One example format was mentioned in https://github.com/dolthub/dolt/issues/7665 and shown below.
MySQL datetime format reference docs
MySQL
select cast("2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251" as DATETIME);
+--------------------------------------------------------------------------+
| cast("2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251" as DATETIME) |
+--------------------------------------------------------------------------+
| 2024-04-03 13:23:45 |
+--------------------------------------------------------------------------+
show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1292 | Truncated incorrect datetime value: '2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251' |
| Warning | 4096 | Delimiter ' ' in position 26 in datetime value '2024-04-03 13:23:44.506434 +0300 EEST m' at row 1 is superfluous and is deprecated. Please remove. |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+
Dolt
select cast("2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251" as DATETIME);
+--------------------------------------------------------------------------+
| cast("2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251" as DATETIME) |
+--------------------------------------------------------------------------+
| NULL |
+--------------------------------------------------------------------------+
show warnings;
+---------+------+--------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: 2024-04-03 13:23:44.506434 +0300 EEST m=+4.349756251 |
+---------+------+--------------------------------------------------------------------------------+