Skip to content

Commit 0ccba62

Browse files
committed
MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
lowercase db and table names before prelocking. Post-fix for 9180e86 This fixes failures on main.lowercase_table4 on Windows
1 parent 4cf7570 commit 0ccba62

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

sql/sql_select.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24577,7 +24577,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str,
2457724577
const char *t_alias= alias;
2457824578

2457924579
str->append(' ');
24580-
if (lower_case_table_names== 1)
24580+
if (lower_case_table_names == 1)
2458124581
{
2458224582
if (alias && alias[0])
2458324583
{

sql/sql_table.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9095,6 +9095,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
90959095
new_table->file->get_foreign_key_list(thd, &fk_list);
90969096
while ((fk= fk_list_it++))
90979097
{
9098+
if (lower_case_table_names)
9099+
{
9100+
char buf[NAME_LEN];
9101+
uint len;
9102+
strmake_buf(buf, fk->referenced_db->str);
9103+
len = my_casedn_str(files_charset_info, buf);
9104+
thd->make_lex_string(fk->referenced_db, buf, len);
9105+
strmake_buf(buf, fk->referenced_table->str);
9106+
len = my_casedn_str(files_charset_info, buf);
9107+
thd->make_lex_string(fk->referenced_table, buf, len);
9108+
}
90989109
if (table_already_fk_prelocked(table_list, fk->referenced_db,
90999110
fk->referenced_table, TL_READ_NO_INSERT))
91009111
continue;

0 commit comments

Comments
 (0)