m-novikov / tree-sitter-sql

SQL syntax highlighting for tree-sitter
MIT License
112 stars 33 forks source link

Error parsing SQL with parameters that are type hinted #79

Open stevenliebregt opened 1 year ago

stevenliebregt commented 1 year ago

Error when parsing the following SQL:

SELECT a, b
FROM foo
WHERE a > $1::INTEGER
GROUP BY b;

Error:

source_file [0, 0] - [4, 0])
  select_statement [0, 0] - [3, 10])
    select_clause [0, 0] - [0, 11])
      select_clause_body [0, 7] - [0, 11])
        identifier [0, 7] - [0, 8])
        identifier [0, 10] - [0, 11])
    from_clause [1, 0] - [1, 8])
      identifier [1, 5] - [1, 8])
    where_clause [2, 0] - [2, 12])
      comparison_operator [2, 6] - [2, 12])
        identifier [2, 6] - [2, 7])
        argument_reference [2, 10] - [2, 12])
    ERROR [2, 12] - [2, 21])
      ERROR [2, 16] - [2, 21])
    group_by_clause [3, 0] - [3, 10])
      group_by_clause_body [3, 9] - [3, 10])
        identifier [3, 9] - [3, 10])