Skip to content

Snowflake Colon (:) Prefix Causes Error #778

@chiefupstart

Description

@chiefupstart

Describe the bug
In Snowflake, a (:) prefix is used for binding variables in SQL statements like:

SELECT *
FROM conform.DimSeas as s
WHERE s.SeaOrganizationIdentifierSea ='32'
   AND :BATCH_PERIOD_LIST in ('ALL','ANY') or 'CURRENT' in (select VALUE from table(split_to_table(:BATCH_PERIOD_LIST,',')))
   AND :SAID_LIST in ('ALL','ANY') or 'IMART' in (select VALUE from table(split_to_table(:SAID_LIST,',')));
 ;

Sql-formatter will throw an error on the lines with :BATCH_PERIOD_LIST, :SAID_LIST, etc.

Expected behavior
I expected sql-formatter to parse the SQL.

Actual behavior

Parse error at token: : at line 19 column 32
Unexpected PROPERTY_ACCESS_OPERATOR token: {"type":"PROPERTY_ACCESS_OPERATOR","raw":":","text":":","start":587}. Instead, I was expecting to see one of the following:
A ")" based on: ...
A ASTERISK token based on: ...
A LIMIT token based on: ...
Etc...

Usage

  • How are you calling / using the library?
    Angular component.
  • What SQL language(s) does this apply to?
    Snowflake
  • Which SQL Formatter version are you using?
    15.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions