m-novikov / tree-sitter-sql

SQL syntax highlighting for tree-sitter
MIT License
110 stars 32 forks source link

Error parsing Redshift SQL #75

Open phil-bergmann opened 1 year ago

phil-bergmann commented 1 year ago

Error when parsing the following SQL:

BEGIN TRANSACTION;

UNLOAD ('
SELECT
    tl.apartment_id AS apartment_id,
    tl.clicks AS delta_clicks
FROM ranking_team.rl_impressions_to_learn_enriched tl
')
TO '{{ params.s3_bucket }}'
IAM_ROLE '{{ params.iam_role }}'
PARQUET PARTITION BY (apartment_id, delta_clicks)
ALLOWOVERWRITE;

END TRANSACTION;

Error:

source_file [0, 0] - [14, 0])
  ERROR [0, 0] - [2, 9])
    ERROR [0, 0] - [0, 3])
    ERROR [0, 6] - [0, 15])
    ERROR [2, 0] - [2, 6])
  select_statement [3, 0] - [10, 48])
    select_clause [3, 0] - [5, 29])
      select_clause_body [4, 4] - [5, 29])
        alias [4, 4] - [4, 35])
          dotted_name [4, 4] - [4, 19])
            identifier [4, 4] - [4, 6])
            identifier [4, 7] - [4, 19])
          identifier [4, 23] - [4, 35])
        alias [5, 4] - [5, 29])
          dotted_name [5, 4] - [5, 13])
            identifier [5, 4] - [5, 6])
            identifier [5, 7] - [5, 13])
          identifier [5, 17] - [5, 29])
    from_clause [6, 0] - [10, 48])
      ERROR [6, 5] - [10, 20])
        alias [6, 5] - [6, 53])
          dotted_name [6, 5] - [6, 50])
            identifier [6, 5] - [6, 17])
            identifier [6, 18] - [6, 50])
          identifier [6, 51] - [6, 53])
        alias [8, 3] - [9, 8])
          string [8, 3] - [8, 27])
          identifier [9, 0] - [9, 8])
        alias [9, 9] - [10, 7])
          string [9, 9] - [9, 32])
          identifier [10, 0] - [10, 7])
        ERROR [10, 8] - [10, 15])
      identifier [10, 22] - [10, 34])
      MISSING ) [10, 34] - [10, 34])
      identifier [10, 36] - [10, 48])
  ERROR [10, 48] - [11, 14])
    ERROR [11, 3] - [11, 14])
  ERROR [13, 0] - [13, 16])
    ERROR [13, 0] - [13, 13])