diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-05-13 18:46:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-05-14 08:40:46 +0400 |
commit | 910c31928ee62646f06e1584e43071df34738afb (patch) | |
tree | 8df826dcfd3c44f11f311de4aaabde7efd072e5b /sql/item_func.cc | |
parent | 23d3d180ca47954c8138fee2a4356e0f7e531fc3 (diff) | |
download | mariadb-git-910c31928ee62646f06e1584e43071df34738afb.tar.gz |
MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with floor/ceil over DECIMAL(X,Y) where X > 16
The DECIMAL data type branch in Item_func_int_val::fix_length_and_dec()
incorrectly used DOUBLE-style length calculation, which resulted in
a smaller data type than the actual result of FLOOR()/CEIL() needs.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 8407dc881be..f76f6515365 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2337,6 +2337,9 @@ void Item_func_int_val::fix_length_and_dec() if ((args[0]->max_length - args[0]->decimals) >= (DECIMAL_LONGLONG_DIGITS - 2)) { + fix_char_length( + my_decimal_precision_to_length_no_truncation( + args[0]->decimal_int_part(), 0, false)); set_handler_by_result_type(DECIMAL_RESULT); } else |