diff options
author | unknown <marko@hundin.mysql.fi> | 2005-04-07 12:16:41 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2005-04-07 12:16:41 +0300 |
commit | f7356d73910f3df3dedf99d2fafd6413cdb6d33d (patch) | |
tree | 7034173189c0c268893de96cb77f0e5983ac1a94 /sql/sql_table.cc | |
parent | 0d17aea729e9f33071eee20fbc0b91fd002ca9bb (diff) | |
download | mariadb-git-f7356d73910f3df3dedf99d2fafd6413cdb6d33d.tar.gz |
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
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5aba764e293..84f51a95691 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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; |