From b0fa30808622fe12d474a70af1838906e60b9897 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Sun, 2 Feb 2020 15:13:29 +0300 Subject: MDEV-21195 INSERT chooses wrong partition for RANGE partitioning by DECIMAL column Use FLOOR rounding for DECIMAL_RESULT item_expr in partition function. --- sql/my_decimal.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/my_decimal.cc') diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 01fad3dde37..8acb46b9ef2 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -345,12 +345,12 @@ void my_decimal_trim(ulonglong *precision, uint *scale) */ int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag, - longlong *l) + longlong *l, decimal_round_mode round_type) { int res; my_decimal rounded; /* decimal_round can return only E_DEC_TRUNCATED */ - decimal_round(d, &rounded, 0, HALF_UP); + decimal_round(d, &rounded, 0, round_type); res= (unsigned_flag ? decimal2ulonglong(&rounded, (ulonglong *) l) : decimal2longlong(&rounded, l)); -- cgit v1.2.1