SQLUserDefinedFunctions invalid lambda crash fix

This commit is contained in:
Maksim Kita 2022-01-21 14:33:57 +00:00
parent cb7bac2db5
commit 3b24c39294
3 changed files with 7 additions and 1 deletions

View File

@ -66,7 +66,12 @@ void InterpreterCreateFunctionQuery::validateFunction(ASTPtr function, const Str
for (const auto & argument : tuple_function_arguments.arguments->children)
{
const auto & argument_name = argument->as<ASTIdentifier>()->name();
const auto * argument_identifier = argument->as<ASTIdentifier>();
if (!argument_identifier)
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Lambda argument must be identifier");
const auto & argument_name = argument_identifier->name();
auto [_, inserted] = arguments.insert(argument_name);
if (!inserted)
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Identifier {} already used as function parameter", argument_name);

View File

@ -0,0 +1 @@
CREATE FUNCTION 02181_invalid_lambda AS lambda(((x * 2) AS x_doubled) + x_doubled); --{serverError 1}