summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2022-04-22 01:32:55 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2022-04-26 18:36:36 +0400
commiteca207c46293bc72dd8d0d5622153fab4d3fccf1 (patch)
tree9958754821cc87bd810e6816d50ec6d6567d4e59 /sql/item_func.cc
parent945245aea4baf5399470ec0cff5d5d51c36a95d6 (diff)
downloadmariadb-git-eca207c46293bc72dd8d0d5622153fab4d3fccf1.tar.gz
MDEV-25317 Assertion `scale <= precision' failed in decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' failed in decimal_bin_size_inline/decimal_bin_size.
Precision should be kept below DECIMAL_MAX_SCALE for computations. It can be bigger in Item_decimal. I'd fix this too but it changes the existing behaviour so problemmatic to ix.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7a7eaf9dc23..4e28e8e9528 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2453,14 +2453,16 @@ bool Item_func_round::fix_length_and_dec()
if (!args[1]->const_item())
{
decimals= args[0]->decimals;
- max_length= float_length(decimals);
if (args[0]->result_type() == DECIMAL_RESULT)
{
- max_length++;
+ max_length= args[0]->max_length;
set_handler_by_result_type(DECIMAL_RESULT);
}
else
+ {
+ max_length= float_length(decimals);
set_handler_by_result_type(REAL_RESULT);
+ }
return FALSE;
}