2022-11-11 21:19:58 +00:00
|
|
|
#include <Interpreters/InterpreterDropNamedCollectionQuery.h>
|
|
|
|
#include <Parsers/ASTDropNamedCollectionQuery.h>
|
|
|
|
#include <Access/ContextAccess.h>
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Interpreters/executeDDLQueryOnCluster.h>
|
2022-12-16 22:57:09 +00:00
|
|
|
#include <Common/NamedCollections/NamedCollectionUtils.h>
|
2022-11-11 21:19:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
BlockIO InterpreterDropNamedCollectionQuery::execute()
|
|
|
|
{
|
|
|
|
auto current_context = getContext();
|
|
|
|
const auto & query = query_ptr->as<const ASTDropNamedCollectionQuery &>();
|
2023-02-11 18:57:41 +00:00
|
|
|
|
|
|
|
current_context->checkAccess(AccessType::DROP_NAMED_COLLECTION, query.collection_name);
|
|
|
|
|
2022-11-11 21:19:58 +00:00
|
|
|
if (!query.cluster.empty())
|
|
|
|
{
|
|
|
|
DDLQueryOnClusterParams params;
|
|
|
|
return executeDDLQueryOnCluster(query_ptr, current_context, params);
|
|
|
|
}
|
|
|
|
|
2023-07-27 06:41:47 +00:00
|
|
|
NamedCollectionUtils::removeFromSQL(query, current_context);
|
2022-11-11 21:19:58 +00:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|