mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #69670 from ClickHouse/sync-executeToDatabaseImpl-with-private-fork
sync changes to `InterpreterDropQuery::executeToDatabaseImpl` from the private fork
This commit is contained in:
commit
9eba103c5e
@ -380,15 +380,16 @@ BlockIO InterpreterDropQuery::executeToDatabase(const ASTDropQuery & query)
|
||||
|
||||
BlockIO InterpreterDropQuery::executeToDatabaseImpl(const ASTDropQuery & query, DatabasePtr & database, std::vector<UUID> & uuids_to_wait)
|
||||
{
|
||||
if (query.kind != ASTDropQuery::Kind::Detach && query.kind != ASTDropQuery::Kind::Drop && query.kind != ASTDropQuery::Kind::Truncate)
|
||||
return {};
|
||||
|
||||
const auto & database_name = query.getDatabase();
|
||||
auto ddl_guard = DatabaseCatalog::instance().getDDLGuard(database_name, "");
|
||||
|
||||
database = tryGetDatabase(database_name, query.if_exists);
|
||||
if (database)
|
||||
{
|
||||
if (query.kind == ASTDropQuery::Kind::Detach || query.kind == ASTDropQuery::Kind::Drop
|
||||
|| query.kind == ASTDropQuery::Kind::Truncate)
|
||||
{
|
||||
if (!database)
|
||||
return {};
|
||||
|
||||
bool drop = query.kind == ASTDropQuery::Kind::Drop;
|
||||
bool truncate = query.kind == ASTDropQuery::Kind::Truncate;
|
||||
|
||||
@ -472,8 +473,6 @@ BlockIO InterpreterDropQuery::executeToDatabaseImpl(const ASTDropQuery & query,
|
||||
/// DETACH or DROP database itself. If TRUNCATE skip dropping/erasing the database.
|
||||
if (!truncate)
|
||||
DatabaseCatalog::instance().detachDatabase(getContext(), database_name, drop, database->shouldBeEmptyOnDetach());
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user