diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-03-12 20:15:18 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-03-14 12:40:01 +0100 |
commit | 1c6f6dc8924f144770a862d74667d7fa0eba55c1 (patch) | |
tree | ad8eb6f3082f1785094541bcce964cd19612b774 /sql/item.cc | |
parent | 885edc4fa50546304c1596e4a477ae75aa3973e0 (diff) | |
download | mariadb-git-1c6f6dc8924f144770a862d74667d7fa0eba55c1.tar.gz |
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.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc index 09ae50fcc59..0e6135d64f8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9853,9 +9853,18 @@ Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd) else { MYSQL_TIME ltime; - unpack_time(val_datetime_packed(), <ime); - new_item= (Item*) new (thd->mem_root) Item_datetime_literal(thd, <ime, - decimals); + if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME) + { + 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; } |