Add Support in the "Position" Function (#463)

* Add support in the position function

* Add Test

* Add lint fixes

* Remove if

* Change from to in

* Remove special method for position

* Fix lint

* PR Review
This commit is contained in:
yuval-illumex 2022-04-25 13:32:16 +03:00 committed by GitHub
parent d2487445b7
commit 8f4f01e517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View file

@ -4588,3 +4588,16 @@ fn parse_time_functions() {
// Validating Parenthesis
one_statement_parses_to("SELECT CURRENT_DATE", sql);
}
#[test]
fn parse_position() {
let sql = "SELECT POSITION('@' IN field)";
let select = verified_only_select(sql);
assert_eq!(
&Expr::Position {
expr: Box::new(Expr::Value(Value::SingleQuotedString("@".to_string()))),
r#in: Box::new(Expr::Identifier(Ident::new("field"))),
},
expr_from_projection(only(&select.projection))
);
}