iffyio commented on code in PR #2015:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2015#discussion_r2311819498


##########
src/ast/mod.rs:
##########
@@ -3314,6 +3314,8 @@ pub enum Statement {
     CreateRole {
         names: Vec<ObjectName>,
         if_not_exists: bool,
+        /// Whether ROLE or USER keyword was used
+        keyword: RoleKeyword,

Review Comment:
   Could we use something like this representation instead? I think its a 
somewhat more invasive changes but clearer API wise.
   ```rust
   struct CreateUserOrRole {
     names: Vec<ObjectName>,
     if_not_exists: bool,
     // Postgres
     login: Option<bool>,
     inherit: Option<bool>,
     // ...
   }
   
   Statement::CreateUser(CreateUserOrRole)
   Statement::CreateRole(CreateUserOrRole)
   
   struct AlterUserOrRole {
     name: Ident
   }
   
   Statement::AlterUser(AlterUserOrRole)
   Statement::AlterRole(AlterUserOrRole)
   ```
   



##########
src/parser/alter.rs:
##########
@@ -39,6 +39,15 @@ impl Parser<'_> {
         ))
     }
 
+    pub fn parse_alter_user(&mut self) -> Result<Statement, ParserError> {
+        if dialect_of!(self is PostgreSqlDialect) {
+            return self.parse_pg_alter_user();
+        }

Review Comment:
   I think we can skip the dialect checks and leave the parser to always accept 
the statement if it shows up



##########
src/parser/alter.rs:
##########
@@ -39,6 +39,15 @@ impl Parser<'_> {
         ))
     }
 
+    pub fn parse_alter_user(&mut self) -> Result<Statement, ParserError> {

Review Comment:
   ```suggestion
       fn parse_alter_user(&mut self) -> Result<Statement, ParserError> {
   ```



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