InnoDB: Reject foreign keys in temporary tables. Closes bug #12084.

innobase/dict/dict0dict.c:
  Add reject_fks parameter to dict_create_foreign_constraints_low and
  dict_create_foreign_constraints.
innobase/include/dict0dict.h:
  Add reject_fks parameter to dict_create_foreign_constraints.
innobase/include/row0mysql.h:
  Add reject_fks parameter to row_table_add_foreign_constraints.
innobase/row/row0mysql.c:
  Add reject_fks parameter to row_table_add_foreign_constraints.
sql/ha_innodb.cc:
  In create, pass correct reject_fks argument to
  row_table_add_foreign_constraints depending on whether we're creating a
  temporary table or not. Also move duplicated cleanup code to a single
  place.
This commit is contained in:
unknown 2005-09-06 14:38:21 +03:00
commit 2d1c26cc61
5 changed files with 59 additions and 47 deletions

View file

@ -4687,13 +4687,7 @@ ha_innobase::create(
form->s->row_type != ROW_TYPE_REDUNDANT);
if (error) {
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
goto cleanup;
}
/* Look for a primary key */
@ -4717,13 +4711,7 @@ ha_innobase::create(
error = create_clustered_index_when_no_primary(trx,
norm_name);
if (error) {
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
goto cleanup;
}
}
@ -4732,13 +4720,7 @@ ha_innobase::create(
first */
if ((error = create_index(trx, form, norm_name,
(uint) primary_key_no))) {
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
goto cleanup;
}
}
@ -4747,14 +4729,7 @@ ha_innobase::create(
if (i != (uint) primary_key_no) {
if ((error = create_index(trx, form, norm_name, i))) {
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
goto cleanup;
}
}
}
@ -4767,21 +4742,18 @@ ha_innobase::create(
current_thd->query_length,
current_thd->charset())) {
error = HA_ERR_OUT_OF_MEM;
} else {
error = row_table_add_foreign_constraints(trx,
q.str, norm_name);
error = convert_error_code_to_mysql(error, NULL);
goto cleanup;
}
error = row_table_add_foreign_constraints(trx,
q.str, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
error = convert_error_code_to_mysql(error, NULL);
if (error) {
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
goto cleanup;
}
}
@ -4821,6 +4793,15 @@ ha_innobase::create(
trx_free_for_mysql(trx);
DBUG_RETURN(0);
cleanup:
innobase_commit_low(trx);
row_mysql_unlock_data_dictionary(trx);
trx_free_for_mysql(trx);
DBUG_RETURN(error);
}
/*********************************************************************