1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug#60196 / Bug#11831040

Setting lowercase_table_names to 2 on Windows causing Foreign Key problems

This problem was exposed by the fix for Bug#55222.  There was a codepath in dict0load.c,
dict_load_foreigns() that made sure the table name matched case sensitive in order to
load a referenced table into the dictionary as needed.  If an engine is rebooted which
accesses a table with foreign keys, and lower_case_table_names=2, then the table with
foreign keys will get an error when it is changed (insert/updated/delete).
Once the referenced tables are loaded into the dictionary cache by a select statement
on those tables, the same change would succeed because the affected code path would
not get followed.
This commit is contained in:
kevin.lewis@oracle.com
2011-03-07 09:42:07 -06:00
parent a3dfebf3e5
commit d072bb0d7f
4 changed files with 173 additions and 3 deletions

View File

@@ -2258,10 +2258,12 @@ loop:
/* Since table names in SYS_FOREIGN are stored in a case-insensitive
order, we have to check that the table name matches also in a binary
string comparison. On Unix, MySQL allows table names that only differ
in character case. */
if (0 != ut_memcmp(field, table_name, len)) {
in character case. If lower_case_table_names=2 then what is stored
may not be the same case, but the previous comparison showed that they
match with no-case. */
if ((srv_lower_case_table_names != 2)
&& (0 != ut_memcmp(field, table_name, len))) {
goto next_rec;
}