diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-06-13 09:30:04 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-06-13 09:30:04 +0400 |
commit | 6c30bc2181328ea619d1ab61a464feb0514bf12a (patch) | |
tree | c5a1bc61de369ed5e5df9fb441fb2aa7ea2e5292 /sql/item_func.h | |
parent | 81a08c5462154e169d0a35e52c023d066065b175 (diff) | |
download | mariadb-git-6c30bc2181328ea619d1ab61a464feb0514bf12a.tar.gz |
MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op
Item_func_div::fix_length_and_dec_temporal() set the return data type to
integer in case of @div_precision_increment==0 for temporal input with FSP=0.
This caused Item_func_div to call int_op(), which is not implemented,
so a crash on DBUG_ASSERT(0) happened.
Fixing fix_length_and_dec_temporal() to set the result type to DECIMAL.
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 3fc02e6e51d..754b1cd1eb2 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -754,11 +754,11 @@ class Item_num_op :public Item_func_numhybrid decimals= 0; set_handler(type_handler_long_or_longlong()); } - void fix_length_and_dec_temporal() + void fix_length_and_dec_temporal(bool downcast_decimal_to_int) { set_handler(&type_handler_newdecimal); fix_length_and_dec_decimal(); - if (decimals == 0) + if (decimals == 0 && downcast_decimal_to_int) set_handler(type_handler_long_or_longlong()); } bool need_parentheses_in_default() { return true; } |