diff options
author | unknown <kevin.lewis@oracle.com> | 2010-11-30 12:25:52 -0600 |
---|---|---|
committer | unknown <kevin.lewis@oracle.com> | 2010-11-30 12:25:52 -0600 |
commit | 2dde698e0e4aa5a4264be6f34742f1f0702c0919 (patch) | |
tree | 329291d76745ac35c234ed2047706464bd4a938a /storage/innobase/dict/dict0load.c | |
parent | 54840ede9f3a0ef3dda8dc18b7bc18b4c3147952 (diff) | |
download | mariadb-git-2dde698e0e4aa5a4264be6f34742f1f0702c0919.tar.gz |
Bug#55222 - RB://517 - Approved by Sunny
InnoDB does not attempt to handle lower_case_table_names == 2 when looking
up foreign table names and referenced table name. It turned that server
variable into a boolean and ignored the possibility of it being '2'.
The setting lower_case_table_names == 2 means that it should be stored and
displayed in mixed case as given, but compared internally in lower case.
Normally the server deals with this since it stores table names. But
InnoDB stores referential constraints for the server, so it needs to keep
track of both lower case and given names.
This solution creates two table name pointers for each foreign and referenced
table name. One to display the name, and one to look it up. Both pointers
point to the same allocated string unless this setting is 2. So the overhead
added is not too much.
Two functions are created in dict0mem.c to populate the ..._lookup versions
of these pointers. Both dict_mem_foreign_table_name_lookup_set() and
dict_mem_referenced_table_name_lookup_set() are called 5 times each.
Diffstat (limited to 'storage/innobase/dict/dict0load.c')
-rw-r--r-- | storage/innobase/dict/dict0load.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 5b01669af29..a5f60d8a2f7 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -40,6 +40,7 @@ Created 4/24/1996 Heikki Tuuri #include "rem0cmp.h" #include "srv0start.h" #include "srv0srv.h" +#include "ha_prototypes.h" /* innobase_casedn_str() */ /** Following are six InnoDB system tables */ @@ -435,6 +436,8 @@ dict_process_sys_fields_rec( return(err_msg); } + +#ifdef FOREIGN_NOT_USED /********************************************************************//** This function parses a SYS_FOREIGN record and populate a dict_foreign_t structure with the information from the record. For detail information @@ -483,13 +486,16 @@ err_len: } foreign->foreign_table_name = mem_heap_strdupl( heap, (const char*) field, len); + dict_mem_foreign_table_name_lookup_set(foreign, TRUE); field = rec_get_nth_field_old(rec, 4/*REF_NAME*/, &len); if (UNIV_UNLIKELY(len < 1 || len == UNIV_SQL_NULL)) { goto err_len; } + foreign->referenced_table_name = mem_heap_strdupl( heap, (const char*) field, len); + dict_mem_referenced_table_name_lookup_set(foreign, TRUE); field = rec_get_nth_field_old(rec, 5/*N_COLS*/, &len); if (UNIV_UNLIKELY(len != 4)) { @@ -502,6 +508,9 @@ err_len: return(NULL); } +#endif /* FOREIGN_NOT_USED */ + +#ifdef FOREIGN_NOT_USED /********************************************************************//** This function parses a SYS_FOREIGN_COLS record and extract necessary information from the record and return to caller. @@ -565,6 +574,8 @@ err_len: return(NULL); } +#endif /* FOREIGN_NOT_USED */ + /********************************************************************//** Determine the flags of a table described in SYS_TABLES. @return compressed page size in kilobytes; or 0 if the tablespace is @@ -2057,12 +2068,15 @@ dict_load_foreign( foreign->id = mem_heap_strdup(foreign->heap, id); field = rec_get_nth_field_old(rec, 3, &len); + foreign->foreign_table_name = mem_heap_strdupl( foreign->heap, (char*) field, len); + dict_mem_foreign_table_name_lookup_set(foreign, TRUE); field = rec_get_nth_field_old(rec, 4, &len); foreign->referenced_table_name = mem_heap_strdupl( foreign->heap, (char*) field, len); + dict_mem_referenced_table_name_lookup_set(foreign, TRUE); btr_pcur_close(&pcur); mtr_commit(&mtr); @@ -2070,7 +2084,7 @@ dict_load_foreign( dict_load_foreign_cols(id, foreign); ref_table = dict_table_check_if_in_cache_low( - foreign->referenced_table_name); + foreign->referenced_table_name_lookup); /* We could possibly wind up in a deep recursive calls if we call dict_table_get_low() again here if there @@ -2103,7 +2117,7 @@ dict_load_foreign( have to load it so that we are able to make type comparisons in the next function call. */ - for_table = dict_table_get_low(foreign->foreign_table_name); + for_table = dict_table_get_low(foreign->foreign_table_name_lookup); if (for_table && ref_table && check_recursive) { /* This is to record the longest chain of ancesters |