[MDEV-25697] TO_CHAR does not take into account capitalization in format elements Created: 2021-05-17  Updated: 2021-05-17

Status: Open
Project: MariaDB Server
Component/s: Server
Affects Version/s: N/A
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20017 Implement TO_CHAR() Oracle compatible... Closed

 Description   

In Oracle, capitalization of the format elements matters. It is documented and actually holds truth:

SELECT TO_CHAR(SYSDATE, 'MONTH') FROM DUAL
MAY 
 
SELECT TO_CHAR(SYSDATE, 'Month') FROM DUAL
May
 
SELECT TO_CHAR(SYSDATE, 'month') FROM DUAL
may 

In MariaDB implementation it is not so. All variants are accepted, but the same result is returned for any of them:

a04ef8a3cb90

MariaDB [test]> SELECT TO_CHAR(SYSDATE, 'MONTH') FROM DUAL;
+---------------------------+
| TO_CHAR(SYSDATE, 'MONTH') |
+---------------------------+
| May                       |
+---------------------------+
1 row in set (0.001 sec)
 
MariaDB [test]> SELECT TO_CHAR(SYSDATE, 'Month') FROM DUAL;
+---------------------------+
| TO_CHAR(SYSDATE, 'Month') |
+---------------------------+
| May                       |
+---------------------------+
1 row in set (0.001 sec)
 
MariaDB [test]> SELECT TO_CHAR(SYSDATE, 'month') FROM DUAL;
+---------------------------+
| TO_CHAR(SYSDATE, 'month') |
+---------------------------+
| May                       |
+---------------------------+
1 row in set (0.001 sec)

I haven't found anything in MDEV-20017 description or comments that would suggest it is intentional. It says that only MONTH is supported (which is not true, as shown above), but even if it were true, it would mean that it returns a different value comparing to Oracle.


Generated at Thu Feb 08 09:39:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.