summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-05-21 13:06:43 +0500
committerRamil Kalimullin <ramil@mysql.com>2009-05-21 13:06:43 +0500
commitfe350c59aa2fe3a41ed8b285aeeff217dc2ebe9e (patch)
tree0185f68987e2f6ff26e9d6e768a54ce71ea7fbbb /sql/item_strfunc.cc
parent8b5ea27aacd6482e24fa813a72e10ee9a3d298a9 (diff)
downloadmariadb-git-fe350c59aa2fe3a41ed8b285aeeff217dc2ebe9e.tar.gz
Fix for bug#44743: Join in combination with concat does not always work
bug#44766: valgrind error when using convert() in a subquery Problem: input and output buffers may be the same converting a string to some charset. That may lead to wrong results/valgrind warnings. Fix: use different buffers.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 501b7e85080..a3140b4db64 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2706,8 +2706,15 @@ String *Item_func_conv_charset::val_str(String *str)
DBUG_ASSERT(fixed == 1);
if (use_cached_value)
return null_value ? 0 : &str_value;
- String *arg= args[0]->val_str(str);
+ /*
+ Here we don't pass 'str' as a parameter to args[0]->val_str()
+ as 'str' may points to 'str_value' (e.g. see Item::save_in_field()),
+ which we use below to convert string.
+ Use argument's 'str_value' instead.
+ */
+ String *arg= args[0]->val_str(&args[0]->str_value);;
uint dummy_errors;
+ arg= args[0]->val_str(&args[0]->str_value);
if (!arg)
{
null_value=1;