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() {
81898189
81908190#[ test]
81918191fn 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
You can’t perform that action at this time.
0 commit comments