summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2010-06-23 13:34:40 +0200
committerJon Olav Hauglid <jon.hauglid@sun.com>2010-06-23 13:34:40 +0200
commitbe3005d9e71e853076b9ee35097ffd976d7207f1 (patch)
tree65e8c411add29a22d287df643b53cc6df44fe7f3 /sql/sql_db.cc
parent94174db16b8d20ee0d719b23877b1835e88a8838 (diff)
downloadmariadb-git-be3005d9e71e853076b9ee35097ffd976d7207f1.tar.gz
Backport from mysql-6.0-codebase of:
------------------------------------------------------------ revno: 3672 committer: lars-erik.bjork@sun.com branch nick: 48067-mysql-6.0-codebase-bugfixing timestamp: Mon 2009-10-26 13:51:43 +0100 message: This is a patch for bug#48067 "A temp table with the same name as an existing table, makes drop database fail" When dropping the database, mysql_rm_known_files() reads the contents of the database directory, and creates a TABLE_LIST object, for each .frm file encountered. Temporary tables, however, are not associated with any .frm file. The list of tables to drop are passed to mysql_rm_table_part2(). This method prefers temporary tables over regular tables, so if there is a temporary table with the same name as a regular, the temporary is removed, leaving the regular table intact. Regular tables are only deleted if there are no temporary tables with the same name. This fix ensures, that for all TABLE_LIST objects that are created by mysql_rm_known_files(), 'open_type' is set to 'OT_BASE_ONLY', to indicate that this is a regular table. In all cases in mysql_rm_table_part2() where we prefer a temporary table to a non-temporary table, we chek if 'open_type' equals 'OT_BASE_ONLY'.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 2e48475f298..5e992d2391c 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -1196,6 +1196,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,
MYSQL50_TABLE_NAME_PREFIX_LENGTH +
strlen(file->name) + 1);
+ table_list->open_type= OT_BASE_ONLY;
/* To be able to correctly look up the table in the table cache. */
if (lower_case_table_names)