summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorgshchepa/uchum@host.loc <>2008-05-13 20:27:46 +0500
committergshchepa/uchum@host.loc <>2008-05-13 20:27:46 +0500
commitba18c0bfd903cd67257bad4e50a97d4ad74fc87b (patch)
tree3f906d54df58a21e49a3d2176bd9d4e84389633b /sql/item_strfunc.cc
parent5eaa779436743ce156d91cdb4ff8b41b6bcc5cda (diff)
downloadmariadb-git-ba18c0bfd903cd67257bad4e50a97d4ad74fc87b.tar.gz
Fixed bug #36488: regexp returns false matches, concatenating
with previous rows. The WHERE clause containing expression: CONCAT(empty_field1, empty_field2, ..., 'literal constant', ...) REGEXP 'regular expression' may return wrong matches. Optimization of the CONCAT function has been fixed.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 4e72f117869..c443364ce52 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -294,6 +294,12 @@ String *Item_func_concat::val_str(String *str)
{
if (!(res=args[i]->val_str(str)))
goto null;
+ /*
+ CONCAT accumulates its result in the result of its the first
+ non-empty argument. Because of this we need is_const to be
+ evaluated only for it.
+ */
+ is_const= args[i]->const_item() || !args[i]->used_tables();
}
else
{