summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-12-08 19:39:23 +0400
committerAlexander Barkov <bar@mariadb.com>2018-12-10 19:25:12 +0400
commit34eb98387f8f46a80fb053081dbe20d415f23b39 (patch)
tree674bfd44acc89e741c26d788e614aa95a69c9936 /sql/item_timefunc.cc
parent5b3db87134bb0af2f04027c42971e560fbbf04ab (diff)
downloadmariadb-git-34eb98387f8f46a80fb053081dbe20d415f23b39.tar.gz
MDEV-13995 MAX(timestamp) returns a wrong result near DST change
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 1b728f561b7..4b072e253c5 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1217,15 +1217,13 @@ bool Item_func_unix_timestamp::get_timestamp_value(my_time_t *seconds,
}
}
- THD *thd= current_thd;
- Datetime dt(thd, args[0], Datetime::Options(TIME_NO_ZERO_IN_DATE, thd));
- if ((null_value= !dt.is_valid_datetime()))
+ Timestamp_or_zero_datetime_native_null native(current_thd, args[0], true);
+ if ((null_value= native.is_null() || native.is_zero_datetime()))
return true;
-
- uint error_code;
- *seconds= TIME_to_timestamp(thd, dt.get_mysql_time(), &error_code);
- *second_part= dt.get_mysql_time()->second_part;
- return (null_value= (error_code == ER_WARN_DATA_OUT_OF_RANGE));
+ Timestamp_or_zero_datetime tm(native);
+ *seconds= tm.tv().tv_sec;
+ *second_part= tm.tv().tv_usec;
+ return false;
}