m-novikov / tree-sitter-sql

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

add support for schema #2

Closed cfabianski closed 2 years ago

cfabianski commented 3 years ago

A table_reference can be my_table or public.my_table. This PR allows this while also keeping the schema and the table name separated.

m-novikov commented 3 years ago

Thank you for the contribution :)

m-novikov commented 3 years ago

After thinking some more about it there are at least 3 cases where we can use dot notation:

Column reference also could be in the form of <schema>.<table>.<column> according to docs Due to this, I think it's better to go with something like dotted_name similar python parser

m-novikov commented 2 years ago

Hey, thanks for the contribution. Note that I modified stuff a bit as I went with a more generic dotted_name node instead of table_reference to cover the cases mentioned above. Appreciate the test cases, they helped quite a bit.

Do you have a particular use case that I should keep in mind?