Skip to content

Commit 287f755

Browse files
committed
Update the error message in parse_query_body
1 parent dfa0cfc commit 287f755

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
@@ -1531,7 +1531,10 @@ impl Parser {
15311531
} else if self.parse_keyword("VALUES") {
15321532
SQLSetExpr::Values(self.parse_values()?)
15331533
} else {
1534-
return self.expected("SELECT or a subquery in the query body", self.peek_token());
1534+
return self.expected(
1535+
"SELECT, VALUES, or a subquery in the query body",
1536+
self.peek_token(),
1537+
);
15351538
};
15361539

15371540
loop {

tests/sqlparser_common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,15 +1979,15 @@ fn parse_exists_subquery() {
19791979
let res = parse_sql_statements("SELECT EXISTS (");
19801980
assert_eq!(
19811981
ParserError::ParserError(
1982-
"Expected SELECT or a subquery in the query body, found: EOF".to_string()
1982+
"Expected SELECT, VALUES, or a subquery in the query body, found: EOF".to_string()
19831983
),
19841984
res.unwrap_err(),
19851985
);
19861986

19871987
let res = parse_sql_statements("SELECT EXISTS (NULL)");
19881988
assert_eq!(
19891989
ParserError::ParserError(
1990-
"Expected SELECT or a subquery in the query body, found: NULL".to_string()
1990+
"Expected SELECT, VALUES, or a subquery in the query body, found: NULL".to_string()
19911991
),
19921992
res.unwrap_err(),
19931993
);
@@ -2388,7 +2388,7 @@ fn lateral_derived() {
23882388
let res = parse_sql_statements(sql);
23892389
assert_eq!(
23902390
ParserError::ParserError(
2391-
"Expected SELECT or a subquery in the query body, found: b".to_string()
2391+
"Expected SELECT, VALUES, or a subquery in the query body, found: b".to_string()
23922392
),
23932393
res.unwrap_err()
23942394
);

0 commit comments

Comments
 (0)