Skip to content

fix: insert_stmt allow ; at the end of SQL. #18399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/query/ast/src/parser/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2989,9 +2989,9 @@ pub fn insert_source_file(i: Input) -> IResult<InsertSource> {
);
map(
rule! {
(VALUES ~ #value?)? ~ FROM ~ #at_string ~ #file_format_clause
(VALUES ~ #value?)? ~ FROM ~ #at_string ~ #file_format_clause ~ ";"? ~ &EOI
},
|(values, _, location, format_options)| InsertSource::LoadFile {
|(values, _, location, format_options, _, _)| InsertSource::LoadFile {
value: values.map(|(_, value)| value).unwrap_or_default(),
location,
format_options,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
>>>> create or replace table t_09_0002 (a int)
<<<<
"Succeeded"
null
"Succeeded"
null
"Succeeded"
null
"Succeeded"
null
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../../../shell_env.sh

query "create or replace table t_09_0002 (a int)"

# insert_stmt
curl -s --header 'Content-Type: application/json' --request POST '127.0.0.1:8000/v1/query/' --data-raw '{"sql": "insert into t_09_0002 from @~/not_exist file_format=(type=csv);", "pagination": { "wait_time_secs": 5}}' -u root: | jq -c ".state",".error"
curl -s --header 'Content-Type: application/json' --request POST '127.0.0.1:8000/v1/query/' --data-raw '{"sql": "insert into t_09_0002 select 1;", "pagination": { "wait_time_secs": 5}}' -u root: | jq -c ".state",".error"
curl -s --header 'Content-Type: application/json' --request POST '127.0.0.1:8000/v1/query/' --data-raw '{"sql": "insert into t_09_0002 values (1);", "pagination": { "wait_time_secs": 5}}' -u root: | jq -c ".state",".error"

# statement
curl -s --header 'Content-Type: application/json' --request POST '127.0.0.1:8000/v1/query/' --data-raw '{"sql": "select 1;", "pagination": { "wait_time_secs": 2}}' -u root: | jq -c ".state",".error"
Loading