Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
12.3, 13.1, 12.3.3
-
Linux/amd64
Description
MariaDB 12.3.3-MariaDB-ubu2404 returns NULL when STR_TO_DATE parses a lowercase English month under utf8mb4_bin using the session's en_US locale. Supplying the same locale explicitly returns 2026-03-01.
Reproducer
Run these statements in one MariaDB session:
SET NAMES utf8mb4; |
SET lc_time_names='en_US'; |
SELECT 'bin_lower', STR_TO_DATE(_utf8mb4'1 march 2026' COLLATE utf8mb4_bin,'%d %M %Y'), STR_TO_DATE(_utf8mb4'1 march 2026' COLLATE utf8mb4_bin,'%d %M %Y','en_US'); |
SHOW WARNINGS;
|
SELECT 'ci_lower', STR_TO_DATE(_utf8mb4'1 march 2026' COLLATE utf8mb4_general_ci,'%d %M %Y'), STR_TO_DATE(_utf8mb4'1 march 2026' COLLATE utf8mb4_general_ci,'%d %M %Y','en_US'); |
SELECT 'bin_title', STR_TO_DATE(_utf8mb4'1 March 2026' COLLATE utf8mb4_bin,'%d %M %Y'), STR_TO_DATE(_utf8mb4'1 March 2026' COLLATE utf8mb4_bin,'%d %M %Y','en_US'); |
Decisive observation
The first value after each label uses the session locale implicitly; the second passes en_US explicitly.
bin_lower NULL 2026-03-01
|
Warning 1411 Incorrect datetime value: '1 march 2026' for function str_to_date
|
ci_lower 2026-03-01 2026-03-01
|
bin_title 2026-03-01 2026-03-01
|
The failure is limited to the combination of the lowercase month, binary collation, and omitted locale argument in this case. The case-insensitive-collation control and title-case control both produce the same date with omitted and explicit locales.
Semantic mismatch
With lc_time_names='en_US', omitting the optional locale and explicitly passing en_US select the same locale. Both calls receive identical text and format and should therefore parse the date as 2026-03-01. Instead, only the omitted-locale call returns NULL and raises warning 1411.
This occurs when STR_TO_DATE parses a lowercase localized month under a binary collation while relying on lc_time_names instead of an explicit locale argument.
Attachments
Issue Links
- is caused by
-
MDEV-26112 STR_TO_DATE should work with lc_time_names
-
- Closed
-