ClickHouse/src/Interpreters/InterpreterDropFunctionQuery.cpp

28 lines
876 B
C++
Raw Normal View History

2021-07-19 23:34:04 +00:00
#include <Access/ContextAccess.h>
#include <Interpreters/Context.h>
2021-05-14 22:43:04 +00:00
#include <Interpreters/FunctionNameNormalizer.h>
#include <Interpreters/InterpreterDropFunctionQuery.h>
2021-08-18 09:29:52 +00:00
#include <Interpreters/UserDefinedObjectsLoader.h>
#include <Interpreters/UserDefinedFunctionFactory.h>
2021-05-14 22:43:04 +00:00
#include <Parsers/ASTDropFunctionQuery.h>
2021-07-19 23:34:04 +00:00
2021-05-14 22:43:04 +00:00
namespace DB
{
BlockIO InterpreterDropFunctionQuery::execute()
{
2021-08-24 16:13:38 +00:00
auto current_context = getContext();
current_context->checkAccess(AccessType::DROP_FUNCTION);
2021-08-23 14:31:58 +00:00
2021-05-14 22:43:04 +00:00
FunctionNameNormalizer().visit(query_ptr.get());
auto & drop_function_query = query_ptr->as<ASTDropFunctionQuery &>();
2021-08-23 14:31:58 +00:00
UserDefinedFunctionFactory::instance().unregisterFunction(drop_function_query.function_name);
2021-08-24 16:13:38 +00:00
UserDefinedObjectsLoader::instance().removeObject(current_context, UserDefinedObjectType::Function, drop_function_query.function_name);
2021-08-18 09:29:52 +00:00
2021-05-14 22:43:04 +00:00
return {};
}
}