Repository navigation
MsSql: Serialize DECLARE variable lists and WITH NAME role renames correctly - #2702
Closed
princejain756 wants to merge 2 commits into
Closed
princejain756 wants to merge 2 commits into
princejain756 wants to merge 2 commits into
Conversation
…rrectly Two MsSql AST nodes serialized in a form their own dialect cannot parse: - DECLARE @A INT, @b INT collected each variable into Statement::Declare::stmts, which Display joined with '; ' so the output reparsed as separate statements and the tail failed to parse. Statement::Declare now carries a DeclareDelimiter: Comma for MsSql, BigQuery and PostgreSQL declarations, Semicolon for Snowflake's DECLARE a; b blocks. - ALTER ROLE x WITH NAME = y mapped to AlterRoleOperation::RenameRole, which serializes the PostgreSQL RENAME TO syntax that MsSqlDialect rejects. The WITH NAME = spelling now parses to a dedicated RenameRoleWithName variant that round-trips under MsSqlDialect.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two
MsSqlDialectAST nodes serialized into SQL their own dialect cannot parse back:Statement::Declarenow carries aDeclareDelimiter:Commafor the MsSql, BigQuery and PostgreSQL declaration forms,Semicolonfor Snowflake'sDECLARE a; bblocks. The T-SQL rename maps to a newAlterRoleOperation::RenameRoleWithNamevariant that emitsWITH NAME =, matching howAddMember/DropMemberalready keep their T-SQL spellings.Verified against the T-SQL docs for DECLARE and ALTER ROLE.
AI assistance disclosure: this change was developed with AI coding assistance.