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


##########
src/ast/ddl.rs:
##########
@@ -5430,6 +5430,151 @@ impl Spanned for AlterFunction {
     }
 }
 
+/// PostgreSQL text search object kind.
+#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub enum TextSearchObjectType {
+    /// `DICTIONARY`
+    Dictionary,
+    /// `CONFIGURATION`
+    Configuration,
+    /// `TEMPLATE`
+    Template,
+    /// `PARSER`
+    Parser,
+}
+
+impl fmt::Display for TextSearchObjectType {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            TextSearchObjectType::Dictionary => write!(f, "DICTIONARY"),
+            TextSearchObjectType::Configuration => write!(f, "CONFIGURATION"),
+            TextSearchObjectType::Template => write!(f, "TEMPLATE"),
+            TextSearchObjectType::Parser => write!(f, "PARSER"),
+        }
+    }
+}
+
+/// PostgreSQL `CREATE TEXT SEARCH ...` statement.
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct CreateTextSearch {
+    /// The specific text search object type.
+    pub object_type: TextSearchObjectType,
+    /// Object name.
+    pub name: ObjectName,
+    /// Parenthesized options.
+    pub options: Vec<SqlOption>,
+}
+
+impl fmt::Display for CreateTextSearch {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(
+            f,
+            "CREATE TEXT SEARCH {} {} ({})",
+            self.object_type,
+            self.name,
+            display_comma_separated(&self.options)
+        )
+    }
+}
+
+impl Spanned for CreateTextSearch {
+    fn span(&self) -> Span {
+        Span::empty()
+    }
+}
+
+/// Option assignment used by `ALTER TEXT SEARCH DICTIONARY ... ( ... )`.

Review Comment:
   I added a PostgreSQL docs link for the text-search option struct and renamed 
it to `AlterTextSearchOption`, since options are now parsed permissively across 
text-search object types.



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