#8600·sqlfluff

ClickHouse: Missing support for HYPOTHETICAL PROJECTIONS

Author: AndrewKurgCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugclickhouse

Search before asking

  • I searched the issues and found no similar issues.

What Happened

sqlfluff can't parse hypothetical projections in the clickhouse dialect.

Expected Behaviour

sqlfluff successfully parses hypothetical projections in the clickhouse dialect.

Observed Behaviour

[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    unparsable:                                               !! Expected: "<Sequence: [<AnyNumberOf: [<Ref: 'DelimiterGrammar'>..., <Delimited: [<Ref: 'StatementSegment'>]>, <AnyNumberOf:...]>"
[L:  1, P:  1]      |        word:                                                 'CREATE'
[L:  1, P:  7]      |        whitespace:                                           ' '
[L:  1, P:  8]      |        word:                                                 'HYPOTHETICAL'
[L:  1, P: 20]      |        whitespace:                                           ' '
[L:  1, P: 21]      |        word:                                                 'PROJECTION'
[L:  1, P: 31]      |        whitespace:                                           ' '
[L:  1, P: 32]      |        word:                                                 'uid_proj'
[L:  1, P: 40]      |        whitespace:                                           ' '
[L:  1, P: 41]      |        word:                                                 'ON'
[L:  1, P: 43]      |        whitespace:                                           ' '
[L:  1, P: 44]      |        word:                                                 'example'
[L:  1, P: 51]      |        whitespace:                                           ' '
[L:  1, P: 52]      |        word:                                                 'INDEX'
[L:  1, P: 57]      |        whitespace:                                           ' '
[L:  1, P: 58]      |        word:                                                 'user_id'
[L:  1, P: 65]      |        whitespace:                                           ' '
[L:  1, P: 66]      |        word:                                                 'TYPE'
[L:  1, P: 70]      |        whitespace:                                           ' '
[L:  1, P: 71]      |        word:                                                 'basic'
[L:  1, P: 76]      |        whitespace:                                           ' '
[L:  1, P: 77]      |        word:                                                 'WITH'
[L:  1, P: 81]      |        whitespace:                                           ' '
[L:  1, P: 82]      |        word:                                                 'SETTINGS'
[L:  1, P: 90]      |        whitespace:                                           ' '
[L:  1, P: 91]      |        start_bracket:                                        '('
[L:  1, P: 92]      |        word:                                                 'index_granularity'
[L:  1, P:109]      |        whitespace:                                           ' '
[L:  1, P:110]      |        equals:                                               '='
[L:  1, P:111]      |        whitespace:                                           ' '
[L:  1, P:112]      |        numeric_literal:                                      '4096'
[L:  1, P:116]      |        comma:                                                ','
[L:  1, P:117]      |        whitespace:                                           ' '
[L:  1, P:118]      |        word:                                                 'index_granularity_bytes'
[L:  1, P:141]      |        whitespace:                                           ' '
[L:  1, P:142]      |        equals:                                               '='
[L:  1, P:143]      |        whitespace:                                           ' '
[L:  1, P:144]      |        numeric_literal:                                      '1048576'
[L:  1, P:151]      |        end_bracket:                                          ')'
[L:  1, P:152]      |        semicolon:                                            ';'
[L:  1, P:153]      |    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 HYPOTHETICAL
                       | PROJECTION uid_proj ...'

How to reproduce

sqlfluff parse --dialect=clickhouse -
CREATE HYPOTHETICAL PROJECTION uid_proj ON example INDEX user_id TYPE basic WITH SETTINGS (index_granularity = 4096, index_granularity_bytes = 1048576);

Dialect

clickhouse

Version

sqlfluff, version 4.3.0, 4d259e33f9dd938559260baf59a16efd8070ee77 python 3.11.16

Configuration

default

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