diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-09-24 19:19:25 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-09-24 19:19:25 +0400 |
commit | 0a359d76272bdf74dfbc1bd3bf9e38140cfaa7a1 (patch) | |
tree | cb6af5b82c6628a47c4ea8be9597346f4a5fb88f /sql/item_func.cc | |
parent | fa9e012a3412ad93159b69e4c7eb7a2eb5bde37f (diff) | |
parent | 5f118b26c83960c8fa98bfd544f57ffd76b55304 (diff) | |
download | mariadb-git-0a359d76272bdf74dfbc1bd3bf9e38140cfaa7a1.tar.gz |
Merge remote-tracking branch 'origin/10.1' into 10.2
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 5deeccc9265..7719e0faa87 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1935,8 +1935,11 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value) void Item_func_mod::result_precision() { + unsigned_flag= args[0]->unsigned_flag; decimals= MY_MAX(args[0]->decimal_scale(), args[1]->decimal_scale()); - max_length= MY_MAX(args[0]->max_length, args[1]->max_length); + uint prec= MY_MAX(args[0]->decimal_precision(), args[1]->decimal_precision()); + fix_char_length(my_decimal_precision_to_length_no_truncation(prec, decimals, + unsigned_flag)); } @@ -1945,6 +1948,10 @@ bool Item_func_mod::fix_length_and_dec() if (Item_num_op::fix_length_and_dec()) return true; maybe_null= 1; + /* + result_precision() sets unsigned_flag for INT_RESULT and DECIMAL_RESULT. + Here we need to set it in case of REAL_RESULT. + */ unsigned_flag= args[0]->unsigned_flag; return false; } |