Skip to content

Commit

Permalink
feat(tsql): clustered index closes #3659
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Jun 15, 2024
1 parent ff3dabc commit fb4d908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlglot/dialects/tsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,15 @@ class Tokenizer(tokens.Tokenizer):

KEYWORDS = {
**tokens.Tokenizer.KEYWORDS,
"CLUSTERED INDEX": TokenType.INDEX,
"DATETIME2": TokenType.DATETIME,
"DATETIMEOFFSET": TokenType.TIMESTAMPTZ,
"DECLARE": TokenType.DECLARE,
"EXEC": TokenType.COMMAND,
"FOR SYSTEM_TIME": TokenType.TIMESTAMP_SNAPSHOT,
"IMAGE": TokenType.IMAGE,
"MONEY": TokenType.MONEY,
"NONCLUSTERED INDEX": TokenType.INDEX,
"NTEXT": TokenType.TEXT,
"OPTION": TokenType.OPTION,
"OUTPUT": TokenType.RETURNING,
Expand Down
3 changes: 3 additions & 0 deletions tests/dialects/test_tsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class TestTSQL(Validator):
dialect = "tsql"

def test_tsql(self):
self.validate_identity(
"CREATE CLUSTERED INDEX [IX_OfficeTagDetail_TagDetailID] ON [dbo].[OfficeTagDetail]([TagDetailID] ASC)"
)
self.validate_identity(
"CREATE INDEX [x] ON [y]([z] ASC) WITH (allow_page_locks=on) ON X([y])"
)
Expand Down

0 comments on commit fb4d908

Please sign in to comment.