Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MySQL datetime parsing behavior #7690

Open
fulghum opened this issue Apr 3, 2024 · 0 comments
Open

Support MySQL datetime parsing behavior #7690

fulghum opened this issue Apr 3, 2024 · 0 comments
Labels
correctness We don't return the same result as MySQL sql Issue with SQL

Comments

@fulghum
Copy link
Contributor

fulghum commented Apr 3, 2024

MySQL behavior for parsing datetime literals is slightly different from Dolt's current behavior. One example format was mentioned in #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 |
+---------+------+--------------------------------------------------------------------------------+
@fulghum fulghum added sql Issue with SQL correctness We don't return the same result as MySQL labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
correctness We don't return the same result as MySQL sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

1 participant