diff options
author | msvensson@pilot.blaudden <> | 2007-02-23 10:28:50 +0100 |
---|---|---|
committer | msvensson@pilot.blaudden <> | 2007-02-23 10:28:50 +0100 |
commit | ba3c96f507c0381531a43f6e5ee0500842f75025 (patch) | |
tree | e9178b12e559072a4d94f12fd15d6492cae096e8 /sql/item_strfunc.cc | |
parent | 0ee93fdb023e3e0400cfdd8469dca244ae63f730 (diff) | |
download | mariadb-git-ba3c96f507c0381531a43f6e5ee0500842f75025.tar.gz |
Bug#25197 repeat function returns null when using table field directly as count
- Return empty string also if count is unsigned and value is 0
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 95cc32b5c8e..627751a1106 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2251,8 +2251,10 @@ String *Item_func_repeat::val_str(String *str) if (args[0]->null_value || args[1]->null_value) goto err; // string and/or delim are null null_value= 0; - if ((count <= 0) && !args[1]->unsigned_flag) // For nicer SQL code + + if (count == 0 || count < 0 && !args[1]->unsigned_flag) return &my_empty_string; + /* Assumes that the maximum length of a String is < INT_MAX32. */ /* Bounds check on count: If this is triggered, we will error. */ if ((ulonglong) count > INT_MAX32) |