sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.37k stars 405 forks source link

[FORMATTING] Issue with format clickhouse formatter. #704

Closed mbtolou closed 10 months ago

mbtolou commented 10 months ago

this is normal sql query in clickhouse .

select
  [('a', 'b', ('obis_code', 2, 3), 3, 'data_type', 2, NULL) ]::Nested(
    a Nullable(String),
    b Nullable(String),
    c Tuple(Nullable(String), Nullable(Int32), Nullable(Int32)),
    d Nullable(Int32),
    e Nullable(String),
    f Nullable(Int32),
    g Nullable(Decimal(14, 6))
  );

when format with prettier sql change to :

select
    [('a', 'b', ('obis_code', 2, 3), 3, 'data_type', 2, NULL)]:: Nested (
        a Nullable (String),
        b Nullable (String),
        c Tuple (Nullable (String), Nullable (Int32), Nullable (Int32)),
        d Nullable (Int32),
        e Nullable (String),
        f Nullable (Int32),
        g Nullable (Decimal (14, 6))
    );

"]::Nested" convert to ":: Nested " !

default dialect : n1sql. other dialect exception in some case !

nene commented 10 months ago

This is to be expected as SQL Formatter does not support the ClickHouse dialect.

See #614