princejain756 opened a new pull request, #2709:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2709

   `ALTER ROLE old_name WITH NAME = new_name`, the only rename form T-SQL 
accepts [1], parses into `AlterRoleOperation::RenameRole`, which `Display` 
renders as `RENAME TO` - syntax T-SQL cannot parse back:
   
   ```rust
   Parser::parse_sql(&MsSqlDialect {}, "ALTER ROLE a WITH NAME = b")
       .unwrap()[0].to_string()
   // "ALTER ROLE a RENAME TO b"  <- fails on reparse under MsSqlDialect
   ```
   
   `RenameRole` now carries a `use_with_name` flag set by the mssql parse path, 
so the statement renders back as `WITH NAME =`. The `RENAME TO` parse path 
(Postgres/Generic) is unchanged.
   
   Verified against the T-SQL grammar [1]: `ALTER ROLE` offers only `ADD 
MEMBER`, `DROP MEMBER`, and `WITH NAME =`; `RENAME TO` does not exist there.
   
   [1] 
https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-role-transact-sql
   
   Written with AI assistance (SWE-2 Max via Devin).
   


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