Skip to content

Commit aa1bba5

Browse files
jnlt3fmguerreiro
authored andcommitted
Fix parse_identifiers not taking semicolons into account (apache#2137)
1 parent a3d6091 commit aa1bba5

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12127,7 +12127,7 @@ impl<'a> Parser<'a> {
1212712127
Token::Word(w) => {
1212812128
idents.push(w.clone().into_ident(self.peek_token_ref().span));
1212912129
}
12130-
Token::EOF | Token::Eq => break,
12130+
Token::EOF | Token::Eq | Token::SemiColon => break,
1213112131
_ => {}
1213212132
}
1213312133
self.advance_token();

tests/sqlparser_postgres.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8175,3 +8175,11 @@ CONSTRAINT check_date CHECK (order_date >= '2023-01-01')\
81758175
_ => panic!("Expected CreateTable"),
81768176
}
81778177
}
8178+
8179+
#[test]
8180+
fn parse_identifiers_semicolon_handling() {
8181+
let statement = "SHOW search_path; SELECT 1";
8182+
pg_and_generic().statements_parse_to(statement, statement);
8183+
let statement = "SHOW search_path; SHOW ALL; SHOW ALL";
8184+
pg_and_generic().statements_parse_to(statement, statement);
8185+
}

0 commit comments

Comments
 (0)