1#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
2#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp"
3
4namespace duckdb {
5
6CreateScalarFunctionInfo::CreateScalarFunctionInfo(ScalarFunction function)
7 : CreateFunctionInfo(CatalogType::SCALAR_FUNCTION_ENTRY), functions(function.name) {
8 name = function.name;
9 functions.AddFunction(function: std::move(function));
10 internal = true;
11}
12CreateScalarFunctionInfo::CreateScalarFunctionInfo(ScalarFunctionSet set)
13 : CreateFunctionInfo(CatalogType::SCALAR_FUNCTION_ENTRY), functions(std::move(set)) {
14 name = functions.name;
15 for (auto &func : functions.functions) {
16 func.name = functions.name;
17 }
18 internal = true;
19}
20
21unique_ptr<CreateInfo> CreateScalarFunctionInfo::Copy() const {
22 ScalarFunctionSet set(name);
23 set.functions = functions.functions;
24 auto result = make_uniq<CreateScalarFunctionInfo>(args: std::move(set));
25 CopyProperties(other&: *result);
26 return std::move(result);
27}
28
29unique_ptr<AlterInfo> CreateScalarFunctionInfo::GetAlterInfo() const {
30 return make_uniq_base<AlterInfo, AddScalarFunctionOverloadInfo>(
31 args: AlterEntryData(catalog, schema, name, OnEntryNotFound::RETURN_NULL), args: functions);
32}
33
34} // namespace duckdb
35