mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-21 19:21:46 +00:00
Adds support for PostgreSQL "END" (#1035)
Signed-off-by: Toby Hede <toby@cipherstash.com>
This commit is contained in:
parent
3d2773a794
commit
541d684fba
3 changed files with 27 additions and 1 deletions
|
@ -420,7 +420,11 @@ impl<'a> Parser<'a> {
|
|||
Token::EOF => break,
|
||||
|
||||
// end of statement
|
||||
Token::Word(word) if word.keyword == Keyword::END => break,
|
||||
Token::Word(word) => {
|
||||
if expecting_statement_delimiter && word.keyword == Keyword::END {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
@ -501,6 +505,10 @@ impl<'a> Parser<'a> {
|
|||
// standard `START TRANSACTION` statement. It is supported
|
||||
// by at least PostgreSQL and MySQL.
|
||||
Keyword::BEGIN => Ok(self.parse_begin()?),
|
||||
// `END` is a nonstandard but common alias for the
|
||||
// standard `COMMIT TRANSACTION` statement. It is supported
|
||||
// by PostgreSQL.
|
||||
Keyword::END => Ok(self.parse_end()?),
|
||||
Keyword::SAVEPOINT => Ok(self.parse_savepoint()?),
|
||||
Keyword::RELEASE => Ok(self.parse_release()?),
|
||||
Keyword::COMMIT => Ok(self.parse_commit()?),
|
||||
|
@ -7821,6 +7829,12 @@ impl<'a> Parser<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn parse_end(&mut self) -> Result<Statement, ParserError> {
|
||||
Ok(Statement::Commit {
|
||||
chain: self.parse_commit_rollback_chain()?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn parse_transaction_modes(&mut self) -> Result<Vec<TransactionMode>, ParserError> {
|
||||
let mut modes = vec![];
|
||||
let mut required = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue