mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
bugfix: Item_cache_temporal::convert_to_basic_const_item assumed DATETIME
while it should look at the actual field_type() and use get_date() or get_time() as appropriate. test case is in the following commit.
This commit is contained in:
15
sql/item.cc
15
sql/item.cc
@@ -9853,9 +9853,18 @@ Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
unpack_time(val_datetime_packed(), <ime);
|
if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME)
|
||||||
new_item= (Item*) new (thd->mem_root) Item_datetime_literal(thd, <ime,
|
{
|
||||||
decimals);
|
unpack_time(val_time_packed(), <ime);
|
||||||
|
new_item= (Item*) new (thd->mem_root) Item_time_literal(thd, <ime,
|
||||||
|
decimals);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unpack_time(val_datetime_packed(), <ime);
|
||||||
|
new_item= (Item*) new (thd->mem_root) Item_datetime_literal(thd, <ime,
|
||||||
|
decimals);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new_item;
|
return new_item;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user