LucaCappelletti94 commented on code in PR #2102:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2102#discussion_r2552379406


##########
src/parser/mod.rs:
##########
@@ -7525,6 +7527,51 @@ impl<'a> Parser<'a> {
         }))
     }
 
+    /// Parse a PostgreSQL-specific [Statement::DropOperator] statement.
+    ///
+    /// ```sql
+    /// DROP OPERATOR [ IF EXISTS ] name ( { left_type | NONE } , right_type ) 
[, ...] [ CASCADE | RESTRICT ]
+    /// ```
+    ///
+    /// [PostgreSQL 
Documentation](https://www.postgresql.org/docs/current/sql-dropoperator.html)
+    pub fn parse_drop_operator(&mut self) -> Result<Statement, ParserError> {
+        let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
+        let operators = self.parse_comma_separated(|p| 
p.parse_operator_signature())?;
+        let drop_behavior = self.parse_optional_drop_behavior();
+        Ok(Statement::DropOperator(DropOperator {
+            if_exists,
+            operators,
+            drop_behavior,
+        }))
+    }
+
+    /// Parse an operator signature for DROP OPERATOR
+    /// Format: name ( { left_type | NONE } , right_type )
+    fn parse_operator_signature(&mut self) -> Result<OperatorSignature, 
ParserError> {

Review Comment:
   I will apply this change in the ide since it needs to be changed in several 
places 



##########
src/ast/ddl.rs:
##########
@@ -4188,3 +4188,62 @@ impl fmt::Display for OperatorPurpose {
         }
     }
 }
+
+/// DROP OPERATOR statement
+/// See <https://www.postgresql.org/docs/current/sql-dropoperator.html>
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct DropOperator {
+    /// IF EXISTS clause
+    pub if_exists: bool,
+    /// One or more operators to drop with their signatures
+    pub operators: Vec<OperatorSignature>,
+    /// CASCADE or RESTRICT
+    pub drop_behavior: Option<DropBehavior>,
+}
+
+/// Operator signature for DROP OPERATOR
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct OperatorSignature {

Review Comment:
   I will apply this change in the ide since it needs to be changed in several 
places 



-- 
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]

Reply via email to