File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -8189,14 +8189,25 @@ fn parse_time_functions() {
8189
8189
8190
8190
#[ test]
8191
8191
fn parse_position ( ) {
8192
- let sql = "SELECT POSITION('@' IN field)" ;
8193
- let select = verified_only_select ( sql) ;
8194
8192
assert_eq ! (
8195
- & Expr :: Position {
8193
+ Expr :: Position {
8196
8194
expr: Box :: new( Expr :: Value ( Value :: SingleQuotedString ( "@" . to_string( ) ) ) ) ,
8197
8195
r#in: Box :: new( Expr :: Identifier ( Ident :: new( "field" ) ) ) ,
8198
8196
} ,
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)" )
8200
8211
) ;
8201
8212
}
8202
8213
You can’t perform that action at this time.
0 commit comments