princejain756 opened a new pull request, #2702:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2702
Two `MsSqlDialect` AST nodes serialized into SQL their own dialect cannot
parse back:
```rust
// DECLARE with a comma-separated variable list:
Parser::parse_sql(&MsSqlDialect {}, "DECLARE @a INT, @b INT")
.unwrap()[0].to_string()
// -> "DECLARE @a INT; @b INT" (the tail fails to reparse)
// ALTER ROLE rename:
Parser::parse_sql(&MsSqlDialect {}, "ALTER ROLE x WITH NAME = y")
.unwrap()[0].to_string()
// -> "ALTER ROLE x RENAME TO y" (MsSql only accepts WITH NAME =)
```
`Statement::Declare` now carries a `DeclareDelimiter`: `Comma` for the
MsSql, BigQuery and PostgreSQL declaration forms, `Semicolon` for Snowflake's
`DECLARE a; b` blocks. The T-SQL rename maps to a new
`AlterRoleOperation::RenameRoleWithName` variant that emits `WITH NAME =`,
matching how `AddMember`/`DropMember` already keep their T-SQL spellings.
Verified against the T-SQL docs for
[DECLARE](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/declare-local-variable-transact-sql)
and [ALTER
ROLE](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-role-transact-sql).
AI assistance disclosure: this change was developed with AI coding
assistance.
--
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]