From b97b9536c71b3ad5ef521a1f21c527057a0a01c6 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 2 Dec 2013 15:09:34 +0400 Subject: MDEV-4857 Wrong result of HOUR('1 00:00:00') modified: mysql-test/r/func_time.result mysql-test/t/func_time.test sql-common/my_time.c sql/item_func.h sql/item_timefunc.cc sql/mysql_priv.h sql/time.cc --- sql/item_timefunc.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/item_timefunc.cc') diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 3baf583eaa0..b618ec038f2 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2033,6 +2033,10 @@ longlong Item_extract::val_int() return 0; neg= ltime.neg ? -1 : 1; + DBUG_ASSERT(ltime.time_type != MYSQL_TIMESTAMP_TIME || ltime.day == 0); + if (ltime.time_type == MYSQL_TIMESTAMP_TIME) + time_to_daytime_interval(<ime); + switch (int_type) { case INTERVAL_YEAR: return ltime.year; case INTERVAL_YEAR_MONTH: return ltime.year*100L+ltime.month; -- cgit v1.2.1