mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug#11493 - Alter table rename to default database does not work without db name qualifying
Supplied the default database name for ALTER TABLE ... RENAME for the new table instead of the old tables db like we do for other ALTERs.
This commit is contained in:
@@ -2599,7 +2599,24 @@ unsent_create_error:
|
||||
break;
|
||||
}
|
||||
if (!select_lex->db)
|
||||
select_lex->db=tables->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)
|
||||
{
|
||||
send_error(thd,ER_NO_DB_ERROR);
|
||||
goto error;
|
||||
}
|
||||
select_lex->db= thd->db;
|
||||
}
|
||||
else
|
||||
select_lex->db=tables->db;
|
||||
}
|
||||
if (check_access(thd,ALTER_ACL,tables->db,&tables->grant.privilege,0,0) ||
|
||||
check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0)||
|
||||
check_merge_table_access(thd, tables->db,
|
||||
|
||||
Reference in New Issue
Block a user