summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authoringo@mysql.com <>2005-08-30 12:35:37 +0200
committeringo@mysql.com <>2005-08-30 12:35:37 +0200
commit3e06800b7f55738b98561aad9820054c72a511a3 (patch)
tree53c1440916313313e88f5095f3618810e0090262 /sql/sql_parse.cc
parent309c40012dba9fde28db69b8d800aa822d8e12fd (diff)
parent2e5d241b6237b5126a5ce456afa7c8d7316518cf (diff)
downloadmariadb-git-3e06800b7f55738b98561aad9820054c72a511a3.tar.gz
Merge mysql.com:/home/mydev/mysql-5.0
into mysql.com:/home/mydev/mysql-5.0-5000
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index c4f0552242d..b0502753b1c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2991,7 +2991,24 @@ end_with_restore_list:
goto error;
}
if (!select_lex->db)
- select_lex->db= first_table->db;
+ {
+ /*
+ In the case of ALTER TABLE ... RENAME we should supply the
+ default database if the new name is not explicitly qualified
+ by a database. (Bug #11493)
+ */
+ if (lex->alter_info.flags & ALTER_RENAME)
+ {
+ if (! thd->db)
+ {
+ my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
+ goto error;
+ }
+ select_lex->db= thd->db;
+ }
+ else
+ select_lex->db= first_table->db;
+ }
if (check_access(thd, ALTER_ACL, first_table->db,
&first_table->grant.privilege, 0, 0) ||
check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0)||