Skip to content

Commit

Permalink
add multi-line error message
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed Feb 14, 2024
1 parent bbf48a6 commit 119f528
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
13 changes: 1 addition & 12 deletions e2e_test/udf/sql_udf.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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';
----
Expand All @@ -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')';

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/handler/create_sql_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 119f528

Please sign in to comment.