mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-03 22:08:16 +00:00
Add negative tests for POSITION (#469)
This commit is contained in:
parent
8f4f01e517
commit
edad20cbb8
1 changed files with 17 additions and 0 deletions
|
@ -4601,3 +4601,20 @@ fn parse_position() {
|
|||
expr_from_projection(only(&select.projection))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_position_negative() {
|
||||
let sql = "SELECT POSITION(foo) from bar";
|
||||
let res = parse_sql_statements(sql);
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Position function must include IN keyword".to_string()),
|
||||
res.unwrap_err()
|
||||
);
|
||||
|
||||
let sql = "SELECT POSITION(foo IN) from bar";
|
||||
let res = parse_sql_statements(sql);
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Expected an expression:, found: )".to_string()),
|
||||
res.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue