Details
-
Bug
-
Status: Open (View Workflow)
-
Trivial
-
Resolution: Unresolved
-
N/A
-
None
Description
Both Oracle and MariaDB allow some leeway in the use of different separators between data string/format elements. Oracle behavior isn't very consistent, so I don't think MariaDB should strive to be compatible for each specific case. However, there are cases when the MariaDB behavior is incompatible with Oracle and looks illogical in general.
For example, an extra dash in the format string is allowed:
|
bb-12.3-MDEV-19683-to_date d5fb3dccd72d816c7181a069b91eedb3c76b2715 |
MariaDB [test]> SELECT TO_DATE('2002 AD', 'YYYY - AD') FROM DUAL; |
+---------------------------------+ |
| TO_DATE('2002 AD', 'YYYY - AD') | |
+---------------------------------+ |
| 2002-02-09 00:00:00 |
|
+---------------------------------+ |
1 row in set (0.001 sec) |
but in the date string it is not:
MariaDB [test]> SELECT TO_DATE('2002 - AD', 'YYYY AD') FROM DUAL; |
+---------------------------------+ |
| TO_DATE('2002 - AD', 'YYYY AD') | |
+---------------------------------+ |
| NULL | |
+---------------------------------+ |
|
|
MariaDB [test]> show warnings;
|
+---------+------+------------------------------------------------------------+ |
| Level | Code | Message | |
+---------+------+------------------------------------------------------------+ |
| Warning | 1411 | Incorrect datetime value: '2002 - AD' for function to_date | |
+---------+------+------------------------------------------------------------+ |
There is no problem with dash as such, or with the date string being longer than the format string, because this also works:
MariaDB [test]> SELECT TO_DATE('2002 - AD', 'YYYY-AD') FROM DUAL; |
+---------------------------------+ |
| TO_DATE('2002 - AD', 'YYYY-AD') | |
+---------------------------------+ |
| 2002-02-09 00:00:00 |
|
+---------------------------------+ |
So the warning must be caused by the date string having a dash while the format string doesn't.
In Oracle, all three work (I think – need to re-check, the fiddle is broken again)
Attachments
Issue Links
- is caused by
-
MDEV-19683 Add support for Oracle TO_DATE()
-
- Approved
-