summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-10-30 17:23:53 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-10-30 17:23:53 +0100
commit794f66513967891520ec432123dcff8270871b93 (patch)
treeda31ab80611c016e9dca9af28ffd65c4a838e2f5 /sql/item_cmpfunc.cc
parent14d43f4fa691e3af113195a3608f1fc401b85090 (diff)
parent72eea39d4c4a8bcadccfdac457e61abc7b618ff8 (diff)
downloadmariadb-git-794f66513967891520ec432123dcff8270871b93.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 195d30c222b..da4c9dd371b 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -843,6 +843,8 @@ int Arg_comparator::compare_decimal()
{
if (set_null)
owner->null_value= 0;
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val1, (*a)->decimals, 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val2, (*b)->decimals, 0);
return my_decimal_cmp(val1, val2);
}
}
@@ -867,7 +869,9 @@ int Arg_comparator::compare_e_decimal()
my_decimal *val2= (*b)->val_decimal(&decimal2);
if ((*a)->null_value || (*b)->null_value)
return MY_TEST((*a)->null_value && (*b)->null_value);
- return MY_TEST(my_decimal_cmp(val1, val2) == 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val1, (*a)->decimals, 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val2, (*b)->decimals, 0);
+ return my_decimal_cmp(val1, val2) == 0;
}