Skip to content

Commit 53c5e27

Browse files
committed
test cleanup
1 parent 9153806 commit 53c5e27

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
@@ -8236,14 +8236,25 @@ fn parse_time_functions() {
82368236

82378237
#[test]
82388238
fn parse_position() {
8239-
let sql = "SELECT POSITION('@' IN field)";
8240-
let select = verified_only_select(sql);
82418239
assert_eq!(
8242-
&Expr::Position {
8240+
Expr::Position {
82438241
expr: Box::new(Expr::Value(Value::SingleQuotedString("@".to_string()))),
82448242
r#in: Box::new(Expr::Identifier(Ident::new("field"))),
82458243
},
8246-
expr_from_projection(only(&select.projection))
8244+
verified_expr("POSITION('@' IN field)"),
8245+
);
8246+
8247+
// some dialects (e.g. snowflake) support position as a function call (i.e. without IN)
8248+
assert_eq!(
8249+
call(
8250+
"position",
8251+
[
8252+
Expr::Value(Value::SingleQuotedString("an".to_owned())),
8253+
Expr::Value(Value::SingleQuotedString("banana".to_owned())),
8254+
Expr::Value(number("1")),
8255+
]
8256+
),
8257+
verified_expr("position('an', 'banana', 1)")
82478258
);
82488259
}
82498260

0 commit comments

Comments
 (0)