summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <osku@127.(none)>2005-09-06 14:38:21 +0300
committerunknown <osku@127.(none)>2005-09-06 14:38:21 +0300
commit2d1c26cc61f83a6d3522fa677c8e7d6d0a89732c (patch)
tree55410fefb1c963b614b51967171775a6bdaab72b /sql/ha_innodb.cc
parent7b2aacb73d43b8d6fa62167610c0cd1e734ffed9 (diff)
downloadmariadb-git-2d1c26cc61f83a6d3522fa677c8e7d6d0a89732c.tar.gz
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.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc61
1 files changed, 21 insertions, 40 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index aa53b69a617..4ed5fadb603 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -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;
}
- if (error) {
- innobase_commit_low(trx);
-
- row_mysql_unlock_data_dictionary(trx);
+ error = row_table_add_foreign_constraints(trx,
+ q.str, norm_name,
+ create_info->options & HA_LEX_CREATE_TMP_TABLE);
- trx_free_for_mysql(trx);
+ error = convert_error_code_to_mysql(error, NULL);
- DBUG_RETURN(error);
+ if (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);
}
/*********************************************************************