From 119f528b5f08c626f731ebe1c77828be39f0fee9 Mon Sep 17 00:00:00 2001 From: Zihao Xu Date: Wed, 14 Feb 2024 11:15:11 +0800 Subject: [PATCH] add multi-line error message --- e2e_test/udf/sql_udf.slt | 13 +------------ src/frontend/src/handler/create_sql_function.rs | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/e2e_test/udf/sql_udf.slt b/e2e_test/udf/sql_udf.slt index a6c0e7c1b916b..a5780fb04f110 100644 --- a/e2e_test/udf/sql_udf.slt +++ b/e2e_test/udf/sql_udf.slt @@ -280,18 +280,6 @@ $1 + 114514 + $1 # Named sql udf with invalid parameter in body definition # Will be rejected at creation time -# P.S. Unfortunately it seems that sqllogictest-rs in RW does not support multi-line error yet -# The following error message is just for reference -# ---------------------------------------- -# 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 failed to find named parameter aa statement error create function unknown_parameter(a INT) returns int language sql as 'select a + aa + a'; ---- @@ -303,6 +291,7 @@ 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 9f6475dad53dd..1fcdeb884b42b 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());