sqlfluff / sqlfluff

A modular SQL linter and auto-formatter with support for multiple dialects and templated code.

Home Page:https://www.sqlfluff.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TSQL] Sqlfluff doesn't recognize create columnstore index statements

paysni opened this issue · comments

Search before asking

  • I searched the issues and found no similar issues.

What Happened

There is a parsing error when trying to parse a create columnstore index statement.

Expected Behaviour

It should be able to handle this simple statement:
CREATE CLUSTERED COLUMNSTORE INDEX cci ON dbo.table;

Observed Behaviour

Parsing error when running the lint/fix/parse command

How to reproduce

run sqlfluff parse against a file with the simple CREATE CLUSTERED COLUMNSTORE INDEX cci ON dbo.table; statement

[L: 1, P: 1] |file:
[L: 1, P: 1] | unparsable: !! Expected: "<Sequence: [<AnyNumberOf: [<Ref: 'BatchDelimiterGram..., <Delimited: [<Ref: 'BatchSegment'>]>]>"
[L: 1, P: 1] | word: 'CREATE'
[L: 1, P: 7] | whitespace: ' '
[L: 1, P: 8] | word: 'CLUSTERED'
[L: 1, P: 17] | whitespace: ' '
[L: 1, P: 18] | word: 'COLUMNSTORE'
[L: 1, P: 29] | whitespace: ' '
[L: 1, P: 30] | word: 'INDEX'
[L: 1, P: 35] | whitespace: ' '
[L: 1, P: 36] | word: 'cci'
[L: 1, P: 39] | whitespace: ' '
[L: 1, P: 40] | word: 'ON'
[L: 1, P: 42] | whitespace: ' '
[L: 1, P: 43] | word: 'dbo'
[L: 1, P: 46] | dot: '.'
[L: 1, P: 47] | word: 'table'
[L: 1, P: 52] | semicolon: ';'
[L: 1, P: 53] | newline: '\n'
[L: 2, P: 1] | [META] end_of_file:

==== parsing violations ====
L: 1 | P: 1 | PRS | Line 1, Position 1: Found unparsable section: 'CREATE CLUSTERED
| COLUMNSTORE INDEX cci O...'

Dialect

tsql

Version

sqlfluff 3.0.2

Configuration

[sqlfluff]
dialect = tsql
max_line_length = 120
#RF06 Exclude forcing Quoted Identifier
#CV01 Exclude using != over <>
#ST06 Exclude column reordering
#AL09 Exclude column alias rule for now.
exclude_rules = RF06, CV01, ST06, AL09
large_file_skip_byte_limit = 0
processes = -1
runaway_limit = 20

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

Fixed in the above PR