summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 3648438a69b..23ac20a4017 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -516,8 +516,9 @@ public:
{
collation.set(default_charset());
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
- max_length= ((char_length + (char_length-args[0]->decimals)/3) *
- collation.collation->mbmaxlen);
+ uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
+ max_length= (char_length + max_sep_count + decimals) *
+ collation.collation->mbmaxlen;
}
const char *func_name() const { return "format"; }
void print(String *);