summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8501bd57b6e..c6e23eb927a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2017,8 +2017,6 @@ mysql_execute_command(void)
case SQLCOM_REVOKE:
case SQLCOM_GRANT:
{
- if (tables && !tables->db)
- tables->db=thd->db;
if (check_access(thd, lex->grant | lex->grant_tot_col | GRANT_ACL,
tables && tables->db ? tables->db : select_lex->db,
tables ? &tables->grant.privilege : 0,
@@ -2205,7 +2203,7 @@ check_access(THD *thd,uint want_access,const char *db, uint *save_priv,
else
save_priv= &dummy;
- if (!db[0] && !thd->db && !dont_check_global_grants)
+ if ((!db || !db[0]) && !thd->db && !dont_check_global_grants)
{
send_error(&thd->net,ER_NO_DB_ERROR); /* purecov: tested */
return TRUE; /* purecov: tested */