Skip to content

Commit 784605c

Browse files
authored
Fix bug when parsing a Snowflake stage with ; suffix (apache#1688)
1 parent 7980c86 commit 784605c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/dialect/snowflake.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ pub fn parse_stage_name_identifier(parser: &mut Parser) -> Result<Ident, ParserE
625625
let mut ident = String::new();
626626
while let Some(next_token) = parser.next_token_no_skip() {
627627
match &next_token.token {
628-
Token::Whitespace(_) => break,
628+
Token::Whitespace(_) | Token::SemiColon => break,
629629
Token::Period => {
630630
parser.prev_token();
631631
break;

tests/sqlparser_snowflake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,6 +3102,10 @@ fn parse_ls_and_rm() {
31023102
};
31033103

31043104
snowflake().verified_stmt(r#"LIST @"STAGE_WITH_QUOTES""#);
3105+
// Semi-colon after stage name - should terminate the stage name
3106+
snowflake()
3107+
.parse_sql_statements("LIST @db1.schema1.stage1/dir1/;")
3108+
.unwrap();
31053109
}
31063110

31073111
#[test]

0 commit comments

Comments
 (0)