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] Column called "type" in Snowflake #771

Closed greg-finley closed 2 months ago

greg-finley commented 3 months ago

Input data

Which SQL and options did you provide as input?

 SELECT 
        SUM(CASE WHEN type = 'upgrade' THEN amount ELSE 0 END) AS upgrade_revenue
    FROM adjustments

Default settings, except dialect Snowflake

Expected Output

No parse error

Actual Output

An Unexpected Error Occurred
Parse error at token: TYPE at line 3 column 23 Unexpected RESERVED_CLAUSE token:

Usage

Changing the variable name to something else like my_type instead of type will parse correctly.

nene commented 2 months ago

Thanks for reporting. Looks like this is the same issue that was fixed for PostgreSQL: #685

nene commented 2 months ago

Fixed in 15.4.1 release