mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Bug#31990: MINUTE() and SECOND() return bogus results when used on a DATE
HOUR(), MINUTE(), ... returned spurious results when used on a DATE-cast. This happened because DATE-cast object did not overload get_time() method in superclass Item. The default method was inappropriate here and misinterpreted the data. Patch adds missing method; get_time() on DATE-casts now returns SQL-NULL on NULL input, 0 otherwise. This coincides with the way DATE-columns behave.
This commit is contained in:

parent
6b92ec4acb
commit
5a5ed2a509
@@ -779,6 +779,7 @@ public:
|
||||
const char *func_name() const { return "cast_as_date"; }
|
||||
String *val_str(String *str);
|
||||
bool get_date(MYSQL_TIME *ltime, uint fuzzy_date);
|
||||
bool get_time(MYSQL_TIME *ltime);
|
||||
const char *cast_type() const { return "date"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
Field *tmp_table_field(TABLE *t_arg)
|
||||
|
Reference in New Issue
Block a user