Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file

disable decoding of table name if the table is internal temporary table
parent 07051cc2
...@@ -85,3 +85,8 @@ select 1; ...@@ -85,3 +85,8 @@ select 1;
1 1
unlock tables; unlock tables;
End of 5.0 tests End of 5.0 tests
create database mysql_test;
create table mysql_test.t1(f1 int);
create table mysql_test.`#sql-347f_7` (f1 int);
drop database mysql_test;
End of 5.1 tests
...@@ -122,3 +122,16 @@ disconnect addconroot2; ...@@ -122,3 +122,16 @@ disconnect addconroot2;
connection default; connection default;
--echo End of 5.0 tests --echo End of 5.0 tests
#
# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
#
create database mysql_test;
create table mysql_test.t1(f1 int);
create table mysql_test.`#sql-347f_7` (f1 int);
create table mysql_test.`#sql-347f_8` (f1 int);
drop table mysql_test.`#sql-347f_8`;
copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm;
drop database mysql_test;
--echo End of 5.1 tests
...@@ -1111,6 +1111,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, ...@@ -1111,6 +1111,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
VOID(filename_to_tablename(file->name, table_list->table_name, VOID(filename_to_tablename(file->name, table_list->table_name,
strlen(file->name) + 1)); strlen(file->name) + 1));
table_list->alias= table_list->table_name; // If lower_case_table_names=2 table_list->alias= table_list->table_name; // If lower_case_table_names=2
table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
/* Link into list */ /* Link into list */
(*tot_list_next)= table_list; (*tot_list_next)= table_list;
tot_list_next= &table_list->next_local; tot_list_next= &table_list->next_local;
......
...@@ -1663,8 +1663,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -1663,8 +1663,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
} }
alias= (lower_case_table_names == 2) ? table->alias : table->table_name; alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove .frm file and engine files */ /* remove .frm file and engine files */
path_length= build_table_filename(path, sizeof(path), path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext,
db, alias, reg_ext, 0); table->internal_tmp_table ?
FN_IS_TMP : 0);
} }
if (drop_temporary || if (drop_temporary ||
(table_type == NULL && (table_type == NULL &&
......
...@@ -1081,6 +1081,7 @@ struct TABLE_LIST ...@@ -1081,6 +1081,7 @@ struct TABLE_LIST
... SELECT implementation). ... SELECT implementation).
*/ */
bool create; bool create;
bool internal_tmp_table;
/* View creation context. */ /* View creation context. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment