summaryrefslogtreecommitdiff
path: root/sql/sql_type.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-08-03 10:53:06 +0400
committerAlexander Barkov <bar@mariadb.com>2020-08-03 10:53:06 +0400
commit9840bb21ef683afd59a30a79ebc5bd5ad33a7c1a (patch)
treed3a79d95550a05c8381855adaa45bc5f2941619d /sql/sql_type.cc
parent97f7bfcebcc17df337bd97c0a9535a906547016d (diff)
downloadmariadb-git-9840bb21ef683afd59a30a79ebc5bd5ad33a7c1a.tar.gz
MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result
Changing that in case of *INT and hex hybrid input: - ROUND(x,NULL) creates a column with the same type as x. The old code created a DOUBLE column, which was not relevant at all. This change simplifies the code a lot. - ROUND(x,non_constant) creates a column of the INT, BIGINT or DECIMAL data type (depending on the exact type of x). The old code created a column of the DOUBLE data type, which lead to precision loss. Hence MDEV-23366. - ROUND(bigint_30,negative_constant) creates a column of the DECIMAL(30,0) data type. The old code created DECIMAL(29,0), which looked strange: the data type promoted to a higher one, but max length reduced. Now the length attribute is preserved.
Diffstat (limited to 'sql/sql_type.cc')
-rw-r--r--sql/sql_type.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index e9d30295406..0b333d44b77 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -5690,7 +5690,7 @@ bool Type_handler_year::
bool Type_handler_hex_hybrid::
Item_func_round_fix_length_and_dec(Item_func_round *item) const
{
- item->fix_arg_int(NULL, NULL, item->arguments()[0]->max_length >= 8);
+ item->fix_arg_hex_hybrid();
return false;
}