summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-03-22 15:22:59 +0100
committerunknown <guilhem@mysql.com>2003-03-22 15:22:59 +0100
commit398707501216b30344c02bbe934c715fdff63cb1 (patch)
tree37f333a3d867843127ec6fed4e6e1c101e06e40f /sql/item_strfunc.cc
parent0f18ab78970cd64418646e83a32d7e487477fb86 (diff)
downloadmariadb-git-398707501216b30344c02bbe934c715fdff63cb1.tar.gz
Fix for #178 Replicating INSERT VALUES(USER()) crashes (SEGV) the slave
Now it does not SEGV, but USER() is still badly replicated (it is replicated to ""), which is a lower priority bug. sql/item_strfunc.cc: Fix for #178 Replicating INSERT VALUES(USER()) crashes (SEGV) the slave Now it does not SEGV, but USER() is still badly replicated (it is replicated to ""), which is a lower priority bug.
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 f1e37889d5f..bff8bc7e3f4 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1373,8 +1373,10 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::val_str(String *str)
{
+ // TODO: make USER() replicate properly (currently it is replicated to "")
THD *thd=current_thd;
- if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
+ if (!(thd->user) || // for system threads (e.g. replication SQL thread)
+ str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
str->append('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string;