diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-02-27 22:43:42 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-02-27 22:43:42 +0100 |
commit | 8d0238a6d8d641939730bdcd1ac4928b2c3c413d (patch) | |
tree | b12aa7ed0f3bc307081355a13c30c3420e1a5c8a /sql/sql_table.cc | |
parent | 570c1a6fef03111976d7cc890e65964cffe9fa1d (diff) | |
download | mariadb-git-8d0238a6d8d641939730bdcd1ac4928b2c3c413d.tar.gz |
MDEV-4955 discover of table non-existance on CREATE
Fix ha_table_exists() to take discovery into account correctly.
It must be able to discover both table existence (when no frm is
found) and table non-existance (when frm was found).
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ee5c8773773..c43ea8c453c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2389,7 +2389,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, This handles the case where a "DROP" was executed and a regular table "may be" dropped as drop_temporary is FALSE and error is TRUE. If the error was FALSE a temporary table was dropped and - regardless of the status of drop_tempoary a "DROP TEMPORARY" + regardless of the status of drop_temporary a "DROP TEMPORARY" must be used. */ if (!dont_log_query) @@ -2417,15 +2417,15 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, } DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table"); error= 0; - if ((drop_temporary || !ha_table_exists(thd, db, alias, &table_type) || - (!drop_view && (was_view= (table_type == view_pseudo_hton))))) + if (drop_temporary || + (ha_table_exists(thd, db, alias, &table_type) == 0 && table_type == 0) || + (!drop_view && (was_view= (table_type == view_pseudo_hton)))) { /* One of the following cases happened: . "DROP TEMPORARY" but a temporary table was not found. - . "DROP" but table was not found on disk and table can't be - created from engine. - . ./sql/datadict.cc +32 /Alfranio - TODO: We need to test this. + . "DROP" but table was not found + . "DROP TABLE" statement, but it's a view. */ if (if_exists) { |