summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authormsvensson@pilot.blaudden <>2007-02-23 10:28:50 +0100
committermsvensson@pilot.blaudden <>2007-02-23 10:28:50 +0100
commitba3c96f507c0381531a43f6e5ee0500842f75025 (patch)
treee9178b12e559072a4d94f12fd15d6492cae096e8 /sql/item_strfunc.cc
parent0ee93fdb023e3e0400cfdd8469dca244ae63f730 (diff)
downloadmariadb-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.cc4
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)