sqldelight icon indicating copy to clipboard operation
sqldelight copied to clipboard

Add support for pg RIGHT/FULL [OUTER] JOIN

Open de-luca opened this issue 1 year ago • 1 comments

Description

Support for RIGHT and FULL joins would be great to have maximum flexibility without relying on hacks using LEFT JOIN or UNION.

de-luca avatar Mar 22 '24 12:03 de-luca

Currently, this is limited by the implementation of JoinClauseMixin in sql-psi project https://github.com/AlecKazakova/sql-psi/blob/6ea26b938a617c74e0b12c782dae9e9a8cc62537/core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/JoinClauseMixin.kt#L65

The base SQL implementation only supports resolving columns with LEFT joins as not all databases e.g MySql support FULL joins.

🛠️ Changing the PostgreSql grammar is possible, but making a change in sql-psi to allow adding more joins clauses needs some thinking about 🤔

It would be beneficial to allow different vendor joins, as the latest version of Sqlite supports RIGHT and FULL joins. MySql supports RIGHT joins and PostgreSql supports additionally LATERAL.

griffio avatar Mar 25 '24 08:03 griffio