fix terminate on uncaught exception

This commit is contained in:
Alexander Tokmakov 2021-09-21 11:04:22 +03:00
parent 5f4c665c76
commit 7e346ec6ec

View File

@ -42,12 +42,17 @@ void DatabaseMemory::dropTable(
try try
{ {
table->drop(); table->drop();
fs::path table_data_dir{getTableDataPath(table_name)}; if (table->storesDataOnDisk())
if (fs::exists(table_data_dir)) {
fs::remove_all(table_data_dir); assert(database_name != DatabaseCatalog::TEMPORARY_DATABASE);
fs::path table_data_dir{getTableDataPath(table_name)};
if (fs::exists(table_data_dir))
fs::remove_all(table_data_dir);
}
} }
catch (...) catch (...)
{ {
assert(database_name != DatabaseCatalog::TEMPORARY_DATABASE);
attachTableUnlocked(table_name, table, lock); attachTableUnlocked(table_name, table, lock);
throw; throw;
} }