Conversation
…g comma SQL Server table definitions commonly use: - IDENTITY or IDENTITY (seed, increment) as a column constraint - CONSTRAINT <name> UNIQUE (...) and CONSTRAINT <name> FOREIGN KEY (...) REFERENCES ..., where only PRIMARY KEY and CHECK were accepted after a constraint name - a trailing comma before the closing parenthesis of CREATE TABLE Each of these produced an ERROR node that swallowed the rest of the table definition.
This branch has not been deployed
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.
SQL Server
CREATE TABLEscripts hit three gaps. Each one produces anERRORnode that swallows the rest of the table definition:Changes:
keyword_identity: a new column constraint,IDENTITYwith an optional(seed, increment). The two values are exposed asseedandincrementfields. Also added tohighlights.scmnext tokeyword_auto_increment._constraint_literal: afterCONSTRAINT <name>it now accepts_key_constraint(UNIQUE / FOREIGN KEY … REFERENCES) as well as PRIMARY KEY and CHECK.column_definitions: accepts an optional trailing,before). The comma after the last constraint left the parser unable to tell whether another constraint or the closing)comes next, so[$.constraints]is added toconflictsto let it try both.The new corpus test is in
test/corpus/create.txt. All existing tests still pass. Unchanged:GENERATED ALWAYS AS IDENTITYproduces the same tree as before.identitystill works as a column name.🤖 Generated with Claude Code