summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-07-22 14:44:25 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-07-22 14:44:25 +0530
commit62d73df6b270cc94ba577e96d3bf325170f306fe (patch)
treed2071cbebbd674ac42b00816a139eb2c1a97c661 /sql/item_func.cc
parent57ec42bc321dee796ce8e711a4499cd665513009 (diff)
downloadmariadb-git-62d73df6b270cc94ba577e96d3bf325170f306fe.tar.gz
MDEV-19232: Floating point precision / value comparison problem
The issue occurs when the subquery_cache is enabled. When there is a cache miss the division was leading to a value with scale 9. In the case of cache hit the value returned was of scale 9 and due to the different values for the scales the where condition evaluated to FALSE, hence the output was incomplete. To fix this problem we need to round up the decimal to the limit mentioned in Item::decimals. This would make sure the values are compared with the same scale.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c41d7809bf9..5e605855d80 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1719,6 +1719,8 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
null_value= 1;
return 0;
}
+ my_decimal_round(E_DEC_FATAL_ERROR, decimal_value,
+ decimals, FALSE, decimal_value);
return decimal_value;
}