diff options
author | gshchepa/uchum@gleb.loc <> | 2007-06-18 17:08:56 +0500 |
---|---|---|
committer | gshchepa/uchum@gleb.loc <> | 2007-06-18 17:08:56 +0500 |
commit | 12c13e7d9edca7ce55913eec3449a518970cfd27 (patch) | |
tree | 5a3f0331e4c22301ccc757da3090d947ac0d598d /sql/item_strfunc.cc | |
parent | 6fc62a8e4a05a87b05aeb44ea6dd7b7df95cfa46 (diff) | |
parent | c27988f9910cee9a9bbb8d186bdb1028a07307df (diff) | |
download | mariadb-git-12c13e7d9edca7ce55913eec3449a518970cfd27.tar.gz |
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 3dc352338a4..a376504512f 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1143,8 +1143,9 @@ String *Item_func_substr::val_str(String *str) (arg_count == 3 && args[2]->null_value)))) return 0; /* purecov: inspected */ - /* Negative length, will return empty string. */ - if ((arg_count == 3) && (length <= 0) && !args[2]->unsigned_flag) + /* Negative or zero length, will return empty string. */ + if ((arg_count == 3) && (length <= 0) && + (length == 0 || !args[2]->unsigned_flag)) return &my_empty_string; /* Assumes that the maximum length of a String is < INT_MAX32. */ |