Commit 805d302d authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6065 MySQL Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH TIME/DATETIME COMPARE

fix for ranges like "indexed_datetime OP time"
(test case is in the previous revision)
parent 6e8d49b8
...@@ -8850,7 +8850,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) ...@@ -8850,7 +8850,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
*/ */
if (field->cmp_type() == TIME_RESULT) if (field->cmp_type() == TIME_RESULT)
{ {
MYSQL_TIME field_time, item_time; MYSQL_TIME field_time, item_time, item_time2, *item_time_cmp= &item_time;
if (field->type() == MYSQL_TYPE_TIME) if (field->type() == MYSQL_TYPE_TIME)
{ {
field->get_time(&field_time); field->get_time(&field_time);
...@@ -8860,8 +8860,11 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) ...@@ -8860,8 +8860,11 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
{ {
field->get_date(&field_time, TIME_INVALID_DATES); field->get_date(&field_time, TIME_INVALID_DATES);
item->get_date(&item_time, TIME_INVALID_DATES); item->get_date(&item_time, TIME_INVALID_DATES);
if (item_time.time_type == MYSQL_TIMESTAMP_TIME)
if (time_to_datetime(thd, &item_time, item_time_cmp= &item_time2))
return 1;
} }
return my_time_compare(&field_time, &item_time); return my_time_compare(&field_time, item_time_cmp);
} }
if (res_type == STRING_RESULT) if (res_type == STRING_RESULT)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment