mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-13 17:36:29 +00:00
mod, parser and test cases for CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] (#678)
This commit is contained in:
parent
b32cbbd855
commit
e3c936a6ce
3 changed files with 53 additions and 0 deletions
|
@ -1904,6 +1904,8 @@ impl<'a> Parser<'a> {
|
|||
self.parse_create_function(temporary)
|
||||
} else if self.parse_keyword(Keyword::ROLE) {
|
||||
self.parse_create_role()
|
||||
} else if self.parse_keyword(Keyword::SEQUENCE) {
|
||||
self.parse_create_sequence(temporary)
|
||||
} else {
|
||||
self.expected("an object type after CREATE", self.peek_token())
|
||||
}
|
||||
|
@ -5414,6 +5416,20 @@ impl<'a> Parser<'a> {
|
|||
clauses,
|
||||
})
|
||||
}
|
||||
|
||||
/// https://www.postgresql.org/docs/current/sql-createsequence.html
|
||||
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
||||
pub fn parse_create_sequence(&mut self, temporary: bool) -> Result<Statement, ParserError> {
|
||||
//[ IF NOT EXISTS ]
|
||||
let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
|
||||
//name
|
||||
let name = self.parse_object_name()?;
|
||||
Ok(Statement::CreateSequence {
|
||||
temporary,
|
||||
if_not_exists,
|
||||
name,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Word {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue