summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 08e1c1c69d3..92fcba4972f 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4860,6 +4860,8 @@ int create_table_impl(THD *thd,
{
if (options.or_replace())
{
+ (void) delete_statistics_for_table(thd, db, table_name);
+
TABLE_LIST table_list;
table_list.init_one_table(db, table_name, 0, TL_WRITE_ALLOW_WRITE);
table_list.table= create_info->table;
@@ -5483,13 +5485,13 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
}
delete file;
- if (unlikely(error))
- {
- if (error == HA_ERR_WRONG_COMMAND)
- my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
- else
- my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
- }
+ if (error == HA_ERR_WRONG_COMMAND)
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
+ else if (error == ENOTDIR)
+ my_error(ER_BAD_DB_ERROR, MYF(0), new_db->str);
+ else if (error)
+ my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
+
else if (!(flags & FN_IS_TMP))
mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name);