InnoDB: Ignore character set mismatch in ALTER TABLE and RENAME TABLE

if foreign_key_checks=0. (Bug #9802)


innobase/dict/dict0dict.c:
  dict_foreign_add_to_cache(): Add flag check_types.
  If the flag is FALSE, ignore character set mismatch.
innobase/dict/dict0load.c:
  dict_load_foreign(), dict_load_foreigns(): Add flag check_types.
  If the flag is FALSE, differences in character sets will be ignored.
innobase/include/dict0dict.h:
  dict_foreign_add_to_cache(): Add flag check_types.
  If the flag is FALSE, differences in character sets will be ignored.
innobase/include/dict0load.h:
  dict_load_foreigns(): Add flag check_types.
  If the flag is FALSE, differences in character sets will be ignored.
innobase/row/row0mysql.c:
  row_table_add_foreign_constraints(), row_rename_table_for_mysql():
  Pass trx->check_foreigns to dict_load_foreigns()
sql/ha_innodb.cc:
  ha_innobase::rename_table(): Clear trx->check_foreign if necessary.
This commit is contained in:
unknown 2005-04-12 16:12:34 +03:00
commit dec90f5b36
6 changed files with 34 additions and 18 deletions

View file

@ -2167,7 +2167,8 @@ ulint
dict_foreign_add_to_cache(
/*======================*/
/* out: DB_SUCCESS or error code */
dict_foreign_t* foreign) /* in, own: foreign key constraint */
dict_foreign_t* foreign, /* in, own: foreign key constraint */
ibool check_types) /* in: TRUE=check type compatibility */
{
dict_table_t* for_table;
dict_table_t* ref_table;
@ -2203,10 +2204,16 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->referenced_table == NULL && ref_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->foreign_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(ref_table,
(const char**) for_in_cache->referenced_col_names,
for_in_cache->n_fields,
for_in_cache->foreign_index);
types_idx);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,
@ -2230,10 +2237,16 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->foreign_table == NULL && for_table) {
dict_index_t* types_idx;
if (check_types) {
types_idx = for_in_cache->referenced_index;
} else {
types_idx = NULL;
}
index = dict_foreign_find_index(for_table,
(const char**) for_in_cache->foreign_col_names,
for_in_cache->n_fields,
for_in_cache->referenced_index);
types_idx);
if (index == NULL) {
dict_foreign_error_report(ef, for_in_cache,