mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-15 08:19:08 +00:00
feat: add duckdb "INSTALL" and "LOAD" (#1127)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
d981b0996a
commit
a5ac425f46
4 changed files with 73 additions and 0 deletions
|
@ -516,6 +516,15 @@ impl<'a> Parser<'a> {
|
|||
Keyword::MERGE => Ok(self.parse_merge()?),
|
||||
// `PRAGMA` is sqlite specific https://www.sqlite.org/pragma.html
|
||||
Keyword::PRAGMA => Ok(self.parse_pragma()?),
|
||||
// `INSTALL` is duckdb specific https://duckdb.org/docs/extensions/overview
|
||||
Keyword::INSTALL if dialect_of!(self is DuckDbDialect | GenericDialect) => {
|
||||
Ok(self.parse_install()?)
|
||||
}
|
||||
// `LOAD` is duckdb specific https://duckdb.org/docs/extensions/overview
|
||||
Keyword::LOAD if dialect_of!(self is DuckDbDialect | GenericDialect) => {
|
||||
Ok(self.parse_load()?)
|
||||
}
|
||||
|
||||
_ => self.expected("an SQL statement", next_token),
|
||||
},
|
||||
Token::LParen => {
|
||||
|
@ -8791,6 +8800,19 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// `INSTALL [extension_name]`
|
||||
pub fn parse_install(&mut self) -> Result<Statement, ParserError> {
|
||||
let extension_name = self.parse_identifier(false)?;
|
||||
|
||||
Ok(Statement::Install { extension_name })
|
||||
}
|
||||
|
||||
/// `LOAD [extension_name]`
|
||||
pub fn parse_load(&mut self) -> Result<Statement, ParserError> {
|
||||
let extension_name = self.parse_identifier(false)?;
|
||||
Ok(Statement::Load { extension_name })
|
||||
}
|
||||
|
||||
/// ```sql
|
||||
/// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue