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:
@ -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;
|
||||
|
Reference in New Issue
Block a user