summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-09-09 15:32:25 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-09-09 15:32:25 +0400
commitc2b38529a9ca2ea09dfa73186d9350a0d6dcd6ac (patch)
treec4aac68dfd58c8f87a6c1cc8d4c456a8fa02e83b /sql/item_timefunc.h
parent02338228dd48752a48d611b03ce35efd35d143d7 (diff)
downloadmariadb-git-c2b38529a9ca2ea09dfa73186d9350a0d6dcd6ac.tar.gz
MDEV-4863 COALESCE(time_or_datetime) returns wrong results in numeric context
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index b17e1c794ee..b0245e6f743 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -372,9 +372,11 @@ public:
max_length=17 + (decimals ? decimals + 1 : 0);
set_persist_maybe_null(1);
}
- void find_num_type() { hybrid_type= decimals ? DECIMAL_RESULT : INT_RESULT; }
+ void find_num_type()
+ { cached_result_type= decimals ? DECIMAL_RESULT : INT_RESULT; }
double real_op() { DBUG_ASSERT(0); return 0; }
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
+ bool date_op(MYSQL_TIME *ltime, uint fuzzydate) { DBUG_ASSERT(0); return true; }
};
@@ -451,12 +453,8 @@ public:
{ return save_date_in_field(field); }
void fix_length_and_dec()
{
- static const uint max_time_type_width[5]=
- { MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH,
- MAX_DATETIME_WIDTH, MIN_TIME_WIDTH };
-
set_persist_maybe_null(1);
- max_length= max_time_type_width[mysql_type_to_time_type(field_type())+2];
+ max_length= mysql_temporal_int_part_length(field_type());
if (decimals)
{
if (decimals == NOT_FIXED_DEC)