Remove dropTable of temp table from InterpreterDropQuery.

This commit is contained in:
Roman Vasin 2023-02-14 17:03:36 +00:00
parent b0ced21c30
commit f410834bfb
2 changed files with 3 additions and 14 deletions

View File

@ -121,14 +121,9 @@ TemporaryTableHolder::~TemporaryTableHolder()
{
if (id != UUIDHelpers::Nil)
{
/// Table maybe dropped before by DROP TEMPORARY TABLE
/// Thus we need to verify the existence of the table before calling dropTable
auto table = temporary_tables->tryGetTable("_tmp_" + toString(id), getContext());
if (table && !table->is_dropped)
{
table->flushAndShutdown();
temporary_tables->dropTable(getContext(), "_tmp_" + toString(id));
}
auto table = getTable();
table->flushAndShutdown();
temporary_tables->dropTable(getContext(), "_tmp_" + toString(id));
}
}

View File

@ -282,12 +282,6 @@ BlockIO InterpreterDropQuery::executeToTemporaryTable(const String & table_name,
else if (kind == ASTDropQuery::Kind::Drop)
{
context_handle->removeExternalTable(table_name);
table->flushAndShutdown();
auto table_lock = table->lockExclusively(getContext()->getCurrentQueryId(), getContext()->getSettingsRef().lock_acquire_timeout);
/// Delete table data
DatabasePtr database = DatabaseCatalog::instance().getDatabase(DatabaseCatalog::TEMPORARY_DATABASE);
UUID table_uuid = table->getStorageID().uuid;
database->dropTable(getContext(), "_tmp_" + toString(table_uuid));
}
else if (kind == ASTDropQuery::Kind::Detach)
{