mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 23:25:34 +02:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
This commit is contained in:
commit
9983cb598f
16 changed files with 123 additions and 54 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -189,7 +189,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 */
|
||||
/*************************************************************************
|
||||
Checks if a table is referenced by foreign keys. */
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,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 */
|
||||
/************************************************************************
|
||||
Prints to the standard output information on all tables found in the data
|
||||
dictionary system table. */
|
||||
|
|
|
|||
|
|
@ -2075,7 +2075,7 @@ row_table_add_foreign_constraints(
|
|||
|
||||
if (err == DB_SUCCESS) {
|
||||
/* Check that also referencing constraints are ok */
|
||||
err = dict_load_foreigns(name);
|
||||
err = dict_load_foreigns(name, trx->check_foreigns);
|
||||
}
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
|
@ -3784,6 +3784,8 @@ row_rename_table_for_mysql(
|
|||
goto funct_exit;
|
||||
}
|
||||
|
||||
err = dict_load_foreigns(new_name, trx->check_foreigns);
|
||||
|
||||
if (row_is_mysql_tmp_table_name(old_name)) {
|
||||
|
||||
/* MySQL is doing an ALTER TABLE command and it
|
||||
|
|
@ -3793,8 +3795,6 @@ row_rename_table_for_mysql(
|
|||
table. But we want to load also the foreign key
|
||||
constraint definitions for the original table name. */
|
||||
|
||||
err = dict_load_foreigns(new_name);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Error: in ALTER TABLE ",
|
||||
|
|
@ -3813,8 +3813,6 @@ row_rename_table_for_mysql(
|
|||
trx->error_state = DB_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
err = dict_load_foreigns(new_name);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue