Fix "parseDateTimeBestEffort" for strings in RFC-2822 when day of week is Thuesday or Thursday #10082

This commit is contained in:
Alexey Milovidov 2020-04-12 22:34:04 +03:00
parent 8cb4dd275a
commit 142087c4f7
3 changed files with 8 additions and 1 deletions

View File

@ -371,7 +371,10 @@ ReturnType parseDateTimeBestEffortImpl(
{
char c = *in.position();
if (c == ' ' || c == 'T')
/// 'T' is a separator between date and time according to ISO 8601.
/// But don't skip it if we didn't read the date part yet, because 'T' is also a prefix or 'Tue' and 'Thu'.
if (c == ' ' || (c == 'T' && year && !has_time))
{
++in.position();
}

View File

@ -0,0 +1,2 @@
2018-08-18 07:22:16
2018-08-16 07:22:16

View File

@ -0,0 +1,2 @@
SELECT toTimeZone(parseDateTimeBestEffort('Thu, 18 Aug 2018 07:22:16 GMT'), 'UTC');
SELECT toTimeZone(parseDateTimeBestEffort('Tue, 16 Aug 2018 07:22:16 GMT'), 'UTC');