File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -1013,9 +1013,15 @@ fn parse_session_options(
10131013 let mut options: Vec < KeyValueOption > = Vec :: new ( ) ;
10141014 let empty = String :: new;
10151015 loop {
1016- match parser. next_token ( ) . token {
1017- Token :: Comma => continue ,
1016+ let next_token = parser. peek_token ( ) ;
1017+ match next_token. token {
1018+ Token :: SemiColon | Token :: EOF => break ,
1019+ Token :: Comma => {
1020+ parser. advance_token ( ) ;
1021+ continue ;
1022+ }
10181023 Token :: Word ( key) => {
1024+ parser. advance_token ( ) ;
10191025 if set {
10201026 let option = parse_option ( parser, key) ?;
10211027 options. push ( option) ;
@@ -1028,10 +1034,7 @@ fn parse_session_options(
10281034 }
10291035 }
10301036 _ => {
1031- if parser. peek_token ( ) . token == Token :: EOF {
1032- break ;
1033- }
1034- return parser. expected ( "another option" , parser. peek_token ( ) ) ;
1037+ return parser. expected ( "another option or end of statement" , next_token) ;
10351038 }
10361039 }
10371040 }
Original file line number Diff line number Diff line change @@ -3505,3 +3505,14 @@ fn test_alter_session() {
35053505 ) ;
35063506 snowflake ( ) . one_statement_parses_to ( "ALTER SESSION UNSET a\n B" , "ALTER SESSION UNSET a, B" ) ;
35073507}
3508+
3509+ #[ test]
3510+ fn test_alter_session_followed_by_statement ( ) {
3511+ let stmts = snowflake ( )
3512+ . parse_sql_statements ( "ALTER SESSION SET QUERY_TAG='hello'; SELECT 42" )
3513+ . unwrap ( ) ;
3514+ match stmts[ ..] {
3515+ [ Statement :: AlterSession { .. } , Statement :: Query { .. } ] => { }
3516+ _ => panic ! ( "Unexpected statements: {:?}" , stmts) ,
3517+ }
3518+ }
You can’t perform that action at this time.
0 commit comments