summaryrefslogtreecommitdiff
path: root/innobase/dict
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-04-13 16:24:17 +0200
committerunknown <mskold@mysql.com>2005-04-13 16:24:17 +0200
commitf0438d548731b674ba989710da0994ac752c623d (patch)
treea1492386b6bc2738d5f8216a4814cf7d15ec4dad /innobase/dict
parent5630f0731ab020471108c67e7ae962ba6eaef625 (diff)
parentf53284f1933d721e3f2a583c2849d9c1b2e2b740 (diff)
downloadmariadb-git-f0438d548731b674ba989710da0994ac752c623d.tar.gz
Merge
innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/include/dict0dict.h: Auto merged innobase/row/row0mysql.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_dynrec.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/r/kill.result: Auto merged mysql-test/t/kill.test: Auto merged ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged ndb/src/kernel/main.cpp: Auto merged ndb/src/mgmsrv/MgmtSrvr.hpp: Auto merged sql/ha_innodb.cc: Auto merged sql/mysqld.cc: Auto merged
Diffstat (limited to 'innobase/dict')
-rw-r--r--innobase/dict/dict0dict.c19
-rw-r--r--innobase/dict/dict0load.c15
2 files changed, 23 insertions, 11 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index f973b994055..8c9724da079 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -2201,7 +2201,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;
@@ -2237,10 +2238,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,
@@ -2264,10 +2271,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,
diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c
index 289b5dab4f2..9bafcf33553 100644
--- a/innobase/dict/dict0load.c
+++ b/innobase/dict/dict0load.c
@@ -868,7 +868,7 @@ dict_load_table(
dict_load_indexes(table, heap);
- err = dict_load_foreigns(table->name);
+ err = dict_load_foreigns(table->name, TRUE);
/*
if (err != DB_SUCCESS) {
@@ -1089,8 +1089,9 @@ ulint
dict_load_foreign(
/*==============*/
/* out: DB_SUCCESS or error code */
- const char* id) /* in: foreign constraint id as a
+ const char* id, /* in: foreign constraint id as a
null-terminated string */
+ ibool check_types)/* in: TRUE=check type compatibility */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
@@ -1102,7 +1103,6 @@ dict_load_foreign(
rec_t* rec;
byte* field;
ulint len;
- ulint err;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
@@ -1204,9 +1204,7 @@ dict_load_foreign(
a new foreign key constraint but loading one from the data
dictionary. */
- err = dict_foreign_add_to_cache(foreign);
-
- return(err);
+ return(dict_foreign_add_to_cache(foreign, check_types));
}
/***************************************************************************
@@ -1220,7 +1218,8 @@ ulint
dict_load_foreigns(
/*===============*/
/* out: DB_SUCCESS or error code */
- const char* table_name) /* in: table name */
+ const char* table_name, /* in: table name */
+ ibool check_types) /* in: TRUE=check type compatibility */
{
btr_pcur_t pcur;
mem_heap_t* heap;
@@ -1320,7 +1319,7 @@ loop:
/* Load the foreign constraint definition to the dictionary cache */
- err = dict_load_foreign(id);
+ err = dict_load_foreign(id, check_types);
if (err != DB_SUCCESS) {
btr_pcur_close(&pcur);