summaryrefslogtreecommitdiff
path: root/sql/sql_rename.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-10 14:25:48 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-04-10 14:25:48 +0500
commit5c5691e8ec0a4c7ffe7990b03008838ae7571d19 (patch)
tree02a7889f4a180d6e984e9e98ee1c8425cd8f51b1 /sql/sql_rename.cc
parent064c1b2cac3ee742d0384edcc4b1988a8c8eba60 (diff)
downloadmariadb-git-5c5691e8ec0a4c7ffe7990b03008838ae7571d19.tar.gz
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.
Diffstat (limited to 'sql/sql_rename.cc')
-rw-r--r--sql/sql_rename.cc9
1 files changed, 7 insertions, 2 deletions
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