sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.53k stars 810 forks source link

Add MERGE INTO support #2272

Open jo2y opened 1 year ago

jo2y commented 1 year ago

What do you want to change?

Free unicorns, plus MERGE INTO!

Postgresql 15 has a MERGE command that sqlc does not appear to support. In fact, it seems to fail silently with no output.

It is somewhat similar in function to an upsert, but allows more guidance to the engine on what to do if the row exists or doesn't exist.

It's a little unclear to me if MySQL and MariaDB support the command. I see third-party blogs and tutorials suggesting its use, but I'm failing to find it in the official docs.

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

kyleconroy commented 1 year ago

Another instance of https://github.com/sqlc-dev/sqlc/issues/1661