summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2004-08-13 17:27:58 +0300
committerheikki@hundin.mysql.fi <>2004-08-13 17:27:58 +0300
commit5273b4e5f5944688b1663454748233ce856719e8 (patch)
tree1d757e4c8cdea455e1c1ef6ddf38df5209ea68ed /innobase
parentc9a46a43d274957f5faed3a9e0ed33e02407bb64 (diff)
downloadmariadb-git-5273b4e5f5944688b1663454748233ce856719e8.tar.gz
row0mysql.c:
Fix bug: if we RENAME a table, InnoDB forgot to load the foreign key constraints that reference the new table name, and forgot to check that they are compatible with the table
Diffstat (limited to 'innobase')
-rw-r--r--innobase/row/row0mysql.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 98ab1a1e754..70743e3a753 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -2641,6 +2641,30 @@ row_rename_table_for_mysql(
NULL);
trx->error_state = DB_SUCCESS;
}
+ } else {
+ err = dict_load_foreigns(new_name);
+
+ if (err != DB_SUCCESS) {
+
+ ut_print_timestamp(stderr);
+
+ fputs(
+ " InnoDB: Error: in RENAME TABLE table ",
+ stderr);
+ ut_print_name(stderr, new_name);
+ fputs("\n"
+ "InnoDB: is referenced in foreign key constraints\n"
+ "InnoDB: which are not compatible with the new table definition.\n",
+ stderr);
+
+ ut_a(dict_table_rename_in_cache(table,
+ old_name, FALSE));
+
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, FALSE,
+ NULL);
+ trx->error_state = DB_SUCCESS;
+ }
}
}
funct_exit: