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 @@ -8236,14 +8236,25 @@ fn parse_time_functions() {
8236
8236
8237
8237
#[ test]
8238
8238
fn parse_position ( ) {
8239
- let sql = "SELECT POSITION('@' IN field)" ;
8240
- let select = verified_only_select ( sql) ;
8241
8239
assert_eq ! (
8242
- & Expr :: Position {
8240
+ Expr :: Position {
8243
8241
expr: Box :: new( Expr :: Value ( Value :: SingleQuotedString ( "@" . to_string( ) ) ) ) ,
8244
8242
r#in: Box :: new( Expr :: Identifier ( Ident :: new( "field" ) ) ) ,
8245
8243
} ,
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)" )
8247
8258
) ;
8248
8259
}
8249
8260
You can’t perform that action at this time.
0 commit comments