DerekStride / tree-sitter-sql

SQL grammar for tree-sitter
http://derek.stride.host/tree-sitter-sql/
MIT License
149 stars 47 forks source link

feat: adds `merge into` upsert statements #182

Closed matthias-Q closed 1 year ago

matthias-Q commented 1 year ago

This PR add the MERGE INTO statement used by Trino/Athena/Snowflake/Iceberg

Reference: https://trino.io/docs/current/sql/merge.html https://docs.snowflake.com/en/sql-reference/sql/merge https://docs.aws.amazon.com/athena/latest/ug/merge-into-statement.html

Note: I also added the "keyword_check" bash script to the test command, so that we check it during development and not just during CI

I think T-SQL and Oracle also support this statement. On a quick glance, Oracle should be covered, T-SQL has some extra commands.

[Update]: I just realized that Postgres also supports this :astonished: It also is almost fully covered! https://www.postgresql.org/docs/current/sql-merge.html