mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
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:
parent
d2487445b7
commit
8f4f01e517
3 changed files with 38 additions and 0 deletions
|
@ -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))
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue