summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-06-15 15:37:14 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-06-16 12:12:17 +0400
commit909f7607018e644754a2c41b791b44b25a05e8fb (patch)
treed49a8ce3a3c08491245446fd4672268856e5361a /sql/sql_table.cc
parentb988553c527d0fb55a561dc3a1308052d94ae2a4 (diff)
downloadmariadb-git-909f7607018e644754a2c41b791b44b25a05e8fb.tar.gz
MDEV-5309 - RENAME TABLE does not check for existence of the table's engine
When RENAME TABLE is executed, it apparently does not check whether the engine is available (unlike ALTER TABLE .. RENAME, which does). It means that if the engine in question was not loaded on some reason, the table might become unusable, since the engine won't know about the change. With this patch RENAME TABLE fails if storage engine is not available.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6ee0e9bc871..c31a6fd6474 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5149,6 +5149,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
ulonglong save_bits= thd->variables.option_bits;
int length;
DBUG_ENTER("mysql_rename_table");
+ DBUG_ASSERT(base);
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db, old_name, new_db, new_name));
@@ -5156,8 +5157,7 @@ mysql_rename_table(handlerton *base, const char *old_db,
if (flags & NO_FK_CHECKS)
thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
- file= (base == NULL ? 0 :
- get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
+ file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
build_table_filename(from, sizeof(from) - 1, old_db, old_name, "",
flags & FN_FROM_IS_TMP);