Merge pull request #33868 from kitaisreal/sql-user-defined-functions-invalid-lambda-crash-fix

SQLUserDefinedFunctions invalid lambda crash fix
This commit is contained in:
Maksim Kita 2022-01-21 16:23:12 +01:00 committed by GitHub
commit 330987a64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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}