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
{
table->drop();
if (table->storesDataOnDisk())
{
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 (...)
{
assert(database_name != DatabaseCatalog::TEMPORARY_DATABASE);
attachTableUnlocked(table_name, table, lock);
throw;
}