Skip to content

Commit 91df9a6

Browse files
committed
Fixes based on comments
1 parent 193e253 commit 91df9a6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/dialect/snowflake.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,10 @@ impl Dialect for SnowflakeDialect {
250250
// Snowflake supports both `BEGIN TRANSACTION` and `BEGIN ... END` blocks.
251251
// If the next keyword indicates a transaction statement, let the
252252
// standard parse_begin() handle it.
253-
if parser.peek_keyword(Keyword::TRANSACTION)
254-
|| parser.peek_keyword(Keyword::WORK)
255-
|| parser.peek_keyword(Keyword::NAME)
256-
|| parser.peek_token().token == Token::SemiColon
257-
|| parser.peek_token().token == Token::EOF
253+
if parser
254+
.peek_one_of_keywords(&[Keyword::TRANSACTION, Keyword::WORK, Keyword::NAME])
255+
.is_some()
256+
|| matches!(parser.peek_token_ref().token, Token::SemiColon | Token::EOF)
258257
{
259258
parser.prev_token();
260259
return None;

tests/sqlparser_snowflake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4626,6 +4626,9 @@ fn test_begin_transaction() {
46264626
.parse_sql_statements("BEGIN; DROP TABLE IF EXISTS bla; COMMIT")
46274627
.unwrap();
46284628
assert_eq!(3, stmts.len());
4629+
4630+
// Bare BEGIN at EOF (no semicolon, no TRANSACTION keyword)
4631+
snowflake().verified_stmt("BEGIN");
46294632
}
46304633

46314634
#[test]

0 commit comments

Comments
 (0)