mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
Remove dropTable of temp table from InterpreterDropQuery.
This commit is contained in:
parent
b0ced21c30
commit
f410834bfb
@ -121,15 +121,10 @@ TemporaryTableHolder::~TemporaryTableHolder()
|
|||||||
{
|
{
|
||||||
if (id != UUIDHelpers::Nil)
|
if (id != UUIDHelpers::Nil)
|
||||||
{
|
{
|
||||||
/// Table maybe dropped before by DROP TEMPORARY TABLE
|
auto table = getTable();
|
||||||
/// 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();
|
table->flushAndShutdown();
|
||||||
temporary_tables->dropTable(getContext(), "_tmp_" + toString(id));
|
temporary_tables->dropTable(getContext(), "_tmp_" + toString(id));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageID TemporaryTableHolder::getGlobalTableID() const
|
StorageID TemporaryTableHolder::getGlobalTableID() const
|
||||||
|
@ -282,12 +282,6 @@ BlockIO InterpreterDropQuery::executeToTemporaryTable(const String & table_name,
|
|||||||
else if (kind == ASTDropQuery::Kind::Drop)
|
else if (kind == ASTDropQuery::Kind::Drop)
|
||||||
{
|
{
|
||||||
context_handle->removeExternalTable(table_name);
|
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)
|
else if (kind == ASTDropQuery::Kind::Detach)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user