Skip to content

Commit dedd361

Browse files
committed
test cleanup
1 parent 6867828 commit dedd361

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/sqlparser_common.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8189,14 +8189,25 @@ fn parse_time_functions() {
81898189

81908190
#[test]
81918191
fn parse_position() {
8192-
let sql = "SELECT POSITION('@' IN field)";
8193-
let select = verified_only_select(sql);
81948192
assert_eq!(
8195-
&Expr::Position {
8193+
Expr::Position {
81968194
expr: Box::new(Expr::Value(Value::SingleQuotedString("@".to_string()))),
81978195
r#in: Box::new(Expr::Identifier(Ident::new("field"))),
81988196
},
8199-
expr_from_projection(only(&select.projection))
8197+
verified_expr("POSITION('@' IN field)"),
8198+
);
8199+
8200+
// some dialects (e.g. snowflake) support position as a function call (i.e. without IN)
8201+
assert_eq!(
8202+
call(
8203+
"position",
8204+
[
8205+
Expr::Value(Value::SingleQuotedString("an".to_owned())),
8206+
Expr::Value(Value::SingleQuotedString("banana".to_owned())),
8207+
Expr::Value(number("1")),
8208+
]
8209+
),
8210+
verified_expr("position('an', 'banana', 1)")
82008211
);
82018212
}
82028213

0 commit comments

Comments
 (0)