summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-04-24 16:59:01 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-04-24 16:59:01 +0400
commitd3d3a4b834db8efc558b71066870b07efe1f2976 (patch)
treeefdfd231e9eb08d5a1728a2989b137d46a93f496 /sql
parentaefddfe3ff3a8502e761871647cc38ec7bf09d62 (diff)
downloadmariadb-git-d3d3a4b834db8efc558b71066870b07efe1f2976.tar.gz
MDEV-4511 Assertion `scale <= precision' fails on GROUP BY TIMEDIFF with incorrect types
Diffstat (limited to 'sql')
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/item_timefunc.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 4d261e7a7d9..f2f5b7b1b63 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -3144,7 +3144,7 @@ void Item_func_str_to_date::fix_length_and_dec()
}
cached_field_type= MYSQL_TYPE_DATETIME;
- decimals= NOT_FIXED_DEC;
+ decimals= TIME_SECOND_PART_DIGITS;
if ((const_item= args[1]->const_item()))
{
char format_buff[64];
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 8f881487e21..29badddad8e 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -809,7 +809,7 @@ public:
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
void fix_length_and_dec()
{
- decimals= args[0]->decimals;
+ decimals= MY_MIN(args[0]->decimals, TIME_SECOND_PART_DIGITS);
Item_timefunc::fix_length_and_dec();
}
const char *func_name() const { return "sec_to_time"; }