mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
Merge pull request #71 from benesch/infix
Don't panic when NOT is not followed by an expected keyword
This commit is contained in:
commit
4f944dd4aa
2 changed files with 10 additions and 1 deletions
|
@ -441,7 +441,7 @@ impl Parser {
|
|||
} else if self.parse_keyword("BETWEEN") {
|
||||
self.parse_between(expr, negated)
|
||||
} else {
|
||||
panic!()
|
||||
self.expected("IN or BETWEEN after NOT", self.peek_token())
|
||||
}
|
||||
}
|
||||
// Can only happen if `get_precedence` got out of sync with this function
|
||||
|
|
|
@ -209,6 +209,15 @@ fn parse_not() {
|
|||
//TODO: add assertions
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_invalid_infix_not() {
|
||||
let res = parse_sql_statements("SELECT c FROM t WHERE c NOT (");
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Expected IN or BETWEEN after NOT, found: (".to_string()),
|
||||
res.unwrap_err(),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_collate() {
|
||||
let sql = "SELECT name COLLATE \"de_DE\" FROM customer";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue