1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

InnoDB: Prevent ALTER TABLE ... ENGINE=...

if there are foreign key constraints on the table. (Bug #5574)


sql/ha_innodb.cc:
  Add method can_switch_engines()
sql/ha_innodb.h:
  Add method can_switch_engines()
sql/handler.h:
  Add method can_switch_engines()
sql/sql_table.cc:
  Check handler::can_switch_engines() before switching storage engines
This commit is contained in:
unknown
2005-04-07 12:16:41 +03:00
parent 0d17aea729
commit f7356d7391
4 changed files with 33 additions and 0 deletions

View File

@ -3109,6 +3109,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Safety fix for innodb */
if (lower_case_table_names)
my_casedn_str(files_charset_info, tmp_name);
if (new_db_type != old_db_type && !table->file->can_switch_engines()) {
my_error(ER_ROW_IS_REFERENCED, MYF(0));
goto err;
}
create_info->db_type=new_db_type;
if (!create_info->comment)
create_info->comment=table->comment;