mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
Add support in IS boolean filter (#474)
* Add support in IS TRUE IS FALSE * Fix lint * Add test for is false
This commit is contained in:
parent
525ba527bb
commit
7732c34b19
2 changed files with 35 additions and 1 deletions
|
@ -4658,3 +4658,25 @@ fn parse_position_negative() {
|
|||
res.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_is_boolean() {
|
||||
one_statement_parses_to(
|
||||
"SELECT f from foo where field is true",
|
||||
"SELECT f FROM foo WHERE field = true",
|
||||
);
|
||||
|
||||
one_statement_parses_to(
|
||||
"SELECT f from foo where field is false",
|
||||
"SELECT f FROM foo WHERE field = false",
|
||||
);
|
||||
|
||||
let sql = "SELECT f from foo where field is 0";
|
||||
let res = parse_sql_statements(sql);
|
||||
assert_eq!(
|
||||
ParserError::ParserError(
|
||||
"Expected [NOT] NULL or [NOT] DISTINCT FROM TRUE FALSE after IS, found: 0".to_string()
|
||||
),
|
||||
res.unwrap_err()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue