diff options
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 5082dfd119a..5fb7ee0ea61 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2651,11 +2651,10 @@ bool Item_func_format::fix_length_and_dec() { uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]); uint dec= FORMAT_MAX_DECIMALS; - if (args[1]->const_item() && !args[1]->is_expensive()) + if (args[1]->const_item() && !args[1]->is_expensive() && !args[1]->null_value) { Longlong_hybrid tmp= args[1]->to_longlong_hybrid(); - if (!args[1]->null_value) - dec= tmp.to_uint(FORMAT_MAX_DECIMALS); + dec= tmp.to_uint(FORMAT_MAX_DECIMALS); } uint32 max_sep_count= (char_length / 3) + (dec ? 1 : 0) + /*sign*/1; collation.set(default_charset()); |