From 5c5691e8ec0a4c7ffe7990b03008838ae7571d19 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Fri, 10 Apr 2009 14:25:48 +0500 Subject: Bug#43385 Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist allow 'rename view' for ALTER ...UPGRADE DATA DIRECTORY NAME command. it's safe because a view has valid internal db&table names in this case. --- sql/sql_rename.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sql/sql_rename.cc') diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index fc87356e452..ced69388009 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -301,8 +301,13 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name, } break; case FRMTYPE_VIEW: - /* change of schema is not allowed */ - if (strcmp(ren_table->db, new_db)) + /* + change of schema is not allowed + except of ALTER ...UPGRADE DATA DIRECTORY NAME command + because a view has valid internal db&table names in this case. + */ + if (thd->lex->sql_command != SQLCOM_ALTER_DB_UPGRADE && + strcmp(ren_table->db, new_db)) my_error(ER_FORBID_SCHEMA_CHANGE, MYF(0), ren_table->db, new_db); else -- cgit v1.2.1