File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2054,6 +2054,34 @@ fn parse_array_subscript() {
2054
2054
pg_and_generic ( ) . verified_expr ( "schedule[:2][2:]" ) ;
2055
2055
}
2056
2056
2057
+ #[ test]
2058
+ fn parse_array_multi_subscript ( ) {
2059
+ let expr = pg_and_generic ( ) . verified_expr ( "make_array(1, 2, 3)[1:2][2]" ) ;
2060
+ assert_eq ! (
2061
+ Expr :: Subscript {
2062
+ expr: Box :: new( Expr :: Subscript {
2063
+ expr: Box :: new( call(
2064
+ "make_array" ,
2065
+ vec![
2066
+ Expr :: Value ( number( "1" ) ) ,
2067
+ Expr :: Value ( number( "2" ) ) ,
2068
+ Expr :: Value ( number( "3" ) )
2069
+ ]
2070
+ ) ) ,
2071
+ subscript: Box :: new( Subscript :: Slice {
2072
+ lower_bound: Some ( Expr :: Value ( number( "1" ) ) ) ,
2073
+ upper_bound: Some ( Expr :: Value ( number( "2" ) ) ) ,
2074
+ stride: None ,
2075
+ } ) ,
2076
+ } ) ,
2077
+ subscript: Box :: new( Subscript :: Index {
2078
+ index: Expr :: Value ( number( "2" ) ) ,
2079
+ } ) ,
2080
+ } ,
2081
+ expr,
2082
+ ) ;
2083
+ }
2084
+
2057
2085
#[ test]
2058
2086
fn parse_create_index ( ) {
2059
2087
let sql = "CREATE INDEX IF NOT EXISTS my_index ON my_table(col1,col2)" ;
You can’t perform that action at this time.
0 commit comments