Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
N/A
-
None
-
Not for Release Notes
Description
The commit comment mentions a case when the data string is shorter than the format string; here we have a different situation, when the data string is longer than the format (the first case), or the data string matches the format, but the values in the string are invalid.
In all cases below, Oracle returns an error, while MariaDB returns a result set, with or without a warning.
Case 1:
Here I don't think it's a problem that MariaDB returns a result when Oracle doesn't, but the results seem strange, I cannot understand how it turns into 2022-01-01 00:00:00
|
7cbf7a8c641379d4318067607b71704956e87e5e 7cbf7a8c641379d4318067607b71704956e87e5e |
SELECT TO_DATE('21-01-09','Y-MM-DD') AS x FROM DUAL; |
|
|
+---------------------+ |
| x |
|
+---------------------+ |
| 2022-01-01 00:00:00 |
|
+---------------------+ |
1 row in set, 1 warning (0.001 sec) |
|
|
MariaDB [test]> show warnings;
|
+---------+------+------------------------------------------------+ |
| Level | Code | Message | |
+---------+------+------------------------------------------------+ |
| Warning | 1292 | Truncated incorrect datetime value: '21-01-09' | |
+---------+------+------------------------------------------------+ |
1 row in set (0.000 sec) |
Case 2:
Here the result is understandable but questionable – should it be really just roll over the year without even a warning?
MariaDB [(none)]> SELECT TO_DATE('2025-366','YYYY-DDD') AS x FROM DUAL; |
+---------------------+ |
| x |
|
+---------------------+ |
| 2026-01-01 00:00:00 |
|
+---------------------+ |
1 row in set (0.001 sec) |
Case 3:
Also understandable how the result is produced (Jan 16 is the current date at the moment of execution), but again questionable whether it should be so. It's one thing when the current date is used to fill missing values, and another when it's used to replace incorrect values.
MariaDB [(none)]> SELECT TO_DATE('2025-000','YYYY-DDD') AS x FROM DUAL; |
+---------------------+ |
| x |
|
+---------------------+ |
| 2025-01-16 00:00:00 |
|
+---------------------+ |
1 row in set (0.001 sec) |
Attachments
Issue Links
- is caused by
-
MDEV-19683 Add support for Oracle TO_DATE()
-
- In Testing
-