mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-12 00:46:19 +00:00
Don't panic on weird infix garbage
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
This commit is contained in:
parent
908082d26f
commit
143846d333
2 changed files with 10 additions and 1 deletions
|
@ -441,7 +441,7 @@ impl Parser {
|
||||||
} else if self.parse_keyword("BETWEEN") {
|
} else if self.parse_keyword("BETWEEN") {
|
||||||
self.parse_between(expr, negated)
|
self.parse_between(expr, negated)
|
||||||
} else {
|
} 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
|
// Can only happen if `get_precedence` got out of sync with this function
|
||||||
|
|
|
@ -209,6 +209,15 @@ fn parse_not() {
|
||||||
//TODO: add assertions
|
//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]
|
#[test]
|
||||||
fn parse_collate() {
|
fn parse_collate() {
|
||||||
let sql = "SELECT name COLLATE \"de_DE\" FROM customer";
|
let sql = "SELECT name COLLATE \"de_DE\" FROM customer";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue