summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d3493e1fad1..995627766c0 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -984,7 +984,10 @@ String *Item_func_left::val_str(String *str)
return &my_empty_string;
if (res->length() <= (uint) length)
return res;
- str_value.set(*res, 0, res->charpos(length));
+ if (&str_value == res)
+ str_value.length(res->charpos(length));
+ else
+ str_value.set(*res, 0, res->charpos(length));
return &str_value;
}