Skip to content

Commit 535505b

Browse files
nickolaybenesch
authored andcommitted
Update the error message in parse_query_body
1 parent 4ee461b commit 535505b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/sqlparser.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,10 @@ impl Parser {
15291529
} else if self.parse_keyword("VALUES") {
15301530
SQLSetExpr::Values(self.parse_values()?)
15311531
} else {
1532-
return self.expected("SELECT or a subquery in the query body", self.peek_token());
1532+
return self.expected(
1533+
"SELECT, VALUES, or a subquery in the query body",
1534+
self.peek_token(),
1535+
);
15331536
};
15341537

15351538
loop {

tests/sqlparser_common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,15 +1990,15 @@ fn parse_exists_subquery() {
19901990
let res = parse_sql_statements("SELECT EXISTS (");
19911991
assert_eq!(
19921992
ParserError::ParserError(
1993-
"Expected SELECT or a subquery in the query body, found: EOF".to_string()
1993+
"Expected SELECT, VALUES, or a subquery in the query body, found: EOF".to_string()
19941994
),
19951995
res.unwrap_err(),
19961996
);
19971997

19981998
let res = parse_sql_statements("SELECT EXISTS (NULL)");
19991999
assert_eq!(
20002000
ParserError::ParserError(
2001-
"Expected SELECT or a subquery in the query body, found: NULL".to_string()
2001+
"Expected SELECT, VALUES, or a subquery in the query body, found: NULL".to_string()
20022002
),
20032003
res.unwrap_err(),
20042004
);
@@ -2399,7 +2399,7 @@ fn lateral_derived() {
23992399
let res = parse_sql_statements(sql);
24002400
assert_eq!(
24012401
ParserError::ParserError(
2402-
"Expected SELECT or a subquery in the query body, found: b".to_string()
2402+
"Expected SELECT, VALUES, or a subquery in the query body, found: b".to_string()
24032403
),
24042404
res.unwrap_err()
24052405
);

0 commit comments

Comments
 (0)