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 @@ -3512,3 +3512,14 @@ fn test_alter_session() {
35123512 ) ;
35133513 snowflake ( ) . one_statement_parses_to ( "ALTER SESSION UNSET a\n B" , "ALTER SESSION UNSET a, B" ) ;
35143514}
3515+
3516+ #[ test]
3517+ fn test_alter_session_followed_by_statement ( ) {
3518+ let stmts = snowflake ( )
3519+ . parse_sql_statements ( "ALTER SESSION SET QUERY_TAG='hello'; SELECT 42" )
3520+ . unwrap ( ) ;
3521+ match stmts[ ..] {
3522+ [ Statement :: AlterSession { .. } , Statement :: Query { .. } ] => { }
3523+ _ => panic ! ( "Unexpected statements: {:?}" , stmts) ,
3524+ }
3525+ }
You can’t perform that action at this time.
0 commit comments