Commit 17537ba7 authored by guilhem@mysql.com's avatar guilhem@mysql.com

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.
parent 61cb6925
...@@ -1373,8 +1373,10 @@ String *Item_func_database::val_str(String *str) ...@@ -1373,8 +1373,10 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::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; 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('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string; return &empty_string;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment