mirror of
https://github.com/MariaDB/server.git
synced 2026-05-05 14:45:31 +02: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:
parent
0d17aea729
commit
f7356d7391
4 changed files with 33 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue