caldwell commented on code in PR #1460:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1460#discussion_r1807942583


##########
src/ast/mod.rs:
##########
@@ -3181,6 +3181,14 @@ pub enum Statement {
         representation: UserDefinedTypeRepresentation,
     },
     /// ```sql
+    /// CREATE TYPE <name> AS ENUM
+    /// ```
+    /// Note: this is a PostgreSQL-specific statement. See 
<https://www.postgresql.org/docs/current/sql-createtype.html>
+    CreateTypeAsEnum {
+        name: ObjectName,
+        labels: Vec<Ident>,
+    },

Review Comment:
   Oh! I somehow missed that `UserDefinedTypeRepresentation` was an enum. I 
thought it was a struct which would be more invasive to change, hence the new 
`CreateTypeAsEnum`. But yeah, as an enum that's a much better place for it.
   
   I ended up with:
   ```rust
   pub enum UserDefinedTypeRepresentation {
       Composite {
           attributes: Vec<UserDefinedTypeCompositeAttributeDef>,
       },
       /// Note: this is PostgreSQL-specific. See 
<https://www.postgresql.org/docs/current/sql-createtype.html>
       Enum { labels: Vec<Ident> },
   }
   ```
   …so that `Enum` matches `Composite`. If you think it should be a real struct 
instead of the anonymous enum struct I can change it.



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