Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mysql-test/main/mdev_38791.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SET sql_mode='ORACLE';
SELECT TO_DATE('Monday Mon', 'DAY DY');
TO_DATE('Monday Mon', 'DAY DY')
NULL
Warnings:
Warning 1411 Incorrect datetime value: 'Monday Mon' for function to_date
SELECT TO_DATE('Mon Mon', 'DY DY');
TO_DATE('Mon Mon', 'DY DY')
NULL
Warnings:
Warning 1411 Incorrect datetime value: 'Mon Mon' for function to_date
4 changes: 4 additions & 0 deletions mysql-test/main/mdev_38791.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SET sql_mode='ORACLE';

SELECT TO_DATE('Monday Mon', 'DAY DY');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add all of the queries mentioned into the JIRa. Also please extend the test suite will all the additional combos you can think of. E.g. IYYY etc.

SELECT TO_DATE('Mon Mon', 'DY DY');
4 changes: 4 additions & 0 deletions sql/item_timefunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,8 @@ static bool parse_format_string(const String *format, uint16 *fmt_array,
}
else if (tmp1 == 'Y')
{
if (for_to_date && formats_used(&used, FMT_DAY))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You sure you just need to check for FMT_DAY? IMHO more is needed.

goto error;
*tmp_fmt= FMT_DY; // Day name
tmp_len+= 3;
type_flags|= PARSE_TYPE_WEEKDAY | PARSE_TYPE_NON_DETERMINISTIC;
Expand All @@ -2990,6 +2992,8 @@ static bool parse_format_string(const String *format, uint16 *fmt_array,
{
if (ptr + 2 == end || my_toupper(system_charset_info, *(ptr+2)) != 'Y')
goto error;
if (for_to_date && formats_used(&used, FMT_DAY))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here

goto error;
*tmp_fmt= FMT_DAY; // Day name
tmp_len+= locale->max_day_name_length * my_charset_utf8mb3_bin.mbmaxlen;
type_flags|= PARSE_TYPE_WEEKDAY | PARSE_TYPE_NON_DETERMINISTIC;
Expand Down