diff --git a/e2e_test/udf/sql_udf.slt b/e2e_test/udf/sql_udf.slt index 10c81d8ce08db..a6c0e7c1b916b 100644 --- a/e2e_test/udf/sql_udf.slt +++ b/e2e_test/udf/sql_udf.slt @@ -291,8 +291,17 @@ $1 + 114514 + $1 # In SQL UDF definition: `select a + aa + a` # ^^ # ---------------------------------------- -statement error failed to find named parameter aa +# statement error failed to find named parameter aa +statement error create function unknown_parameter(a INT) returns int language sql as 'select a + aa + a'; +---- +db error: ERROR: Failed to run the query + +Caused by: + Invalid input syntax: Failed to conduct semantic check +Bind error: [sql udf] failed to find named parameter aa +In SQL UDF definition: `select a + aa + a` + ^^ statement error Expected end of statement, found: 💩 create function call_regexp_replace() returns varchar language sql as 'select regexp_replace('💩💩💩💩💩foo🤔️bar亲爱的😭baz这不是爱情❤️‍🔥', 'baz(...)', '这是🥵', 'ic')'; diff --git a/src/frontend/src/handler/create_sql_function.rs b/src/frontend/src/handler/create_sql_function.rs index 1fcdeb884b42b..9f6475dad53dd 100644 --- a/src/frontend/src/handler/create_sql_function.rs +++ b/src/frontend/src/handler/create_sql_function.rs @@ -259,7 +259,7 @@ pub async fn handle_create_sql_function( ); return Err(ErrorCode::InvalidInputSyntax(format!( - "{}\n{}\n{}`{}`\n{}", + "{}\n {}\n {}`{}`\n{}", DEFAULT_ERR_MSG, invalid_msg, PROMPT, body, position )) .into());