iffyio commented on code in PR #1610:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1610#discussion_r1891410068
##########
src/parser/mod.rs:
##########
@@ -5861,6 +5863,22 @@ impl<'a> Parser<'a> {
})
}
+ pub fn parse_drop_extension(&mut self) -> Result<Statement, ParserError> {
+ let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
+ let names = self.parse_comma_separated(|p| p.parse_identifier(false))?;
+ let cascade_or_restrict =
+ self.parse_one_of_keywords(&[Keyword::CASCADE, Keyword::RESTRICT]);
+ Ok(Statement::DropExtension {
+ names,
+ if_exists,
+ cascade_or_restrict: cascade_or_restrict.map(|k| match k {
+ Keyword::CASCADE => ReferentialAction::Cascade,
+ Keyword::RESTRICT => ReferentialAction::Restrict,
+ _ => unreachable!(),
Review Comment:
in place of panicking here in case we missed something/bug, we can return an
explicit error `return self.expected(..)`?
##########
src/parser/mod.rs:
##########
@@ -5861,6 +5863,22 @@ impl<'a> Parser<'a> {
})
}
+ pub fn parse_drop_extension(&mut self) -> Result<Statement, ParserError> {
Review Comment:
Since the function is being made a public function, could we include a
description for it?
##########
src/ast/mod.rs:
##########
@@ -2759,6 +2759,15 @@ pub enum Statement {
version: Option<Ident>,
},
/// ```sql
+ /// DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
+ /// ```
Review Comment:
Could we also include the link in the description here? would help folks
find the syntax quicker in the future if needed
##########
tests/sqlparser_postgres.rs:
##########
@@ -662,6 +662,22 @@ fn parse_create_extension() {
.verified_stmt("CREATE EXTENSION extension_name WITH SCHEMA
schema_name VERSION version");
}
+#[test]
+fn parse_drop_extension() {
+ pg_and_generic().verified_stmt("DROP EXTENSION extension_name");
Review Comment:
Since the feature introduces a new node to the ast can we add one scenario
that asserts the ast in [this
style](https://github.com/apache/datafusion-sqlparser-rs/blob/04d8502677a85b2c166aabedf25c6bc94a039a0b/tests/sqlparser_postgres.rs#L567-L579)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]