1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Bug#26703: DROP DATABASE fails if database contains a #mysql50# \

table with backticks

(Thanks to Lu Jingdong, though I did not take his patch directly, as
it contained a significant flaw.)

It wasn't a backtick/parsing problem.  We merely didn't anticipate
and allocate enough space to handle the optional "#mysql50#" table-
name prefix. 

Now, allocate that extra space in case we need it when we look up 
a legacy table to get its file's name.
This commit is contained in:
cmiller@zippy.cornsilk.net
2008-03-12 12:40:12 -04:00
parent b077981fbb
commit 05258bfa61
3 changed files with 33 additions and 2 deletions

View File

@@ -1111,12 +1111,17 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
/* Drop the table nicely */
*extension= 0; // Remove extension
TABLE_LIST *table_list=(TABLE_LIST*)
thd->calloc(sizeof(*table_list)+ strlen(db)+strlen(file->name)+2);
thd->calloc(sizeof(*table_list) +
strlen(db) + 1 +
MYSQL50_TABLE_NAME_PREFIX_LENGTH +
strlen(file->name) + 1);
if (!table_list)
goto err;
goto err;
table_list->db= (char*) (table_list+1);
table_list->table_name= strmov(table_list->db, db) + 1;
VOID(filename_to_tablename(file->name, table_list->table_name,
MYSQL50_TABLE_NAME_PREFIX_LENGTH +
strlen(file->name) + 1));
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);