sqlc-dev / sqlc

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

Support multiple conflict targets in upsert statements for SQLite parser #3440

Open maxsei opened 2 weeks ago

maxsei commented 2 weeks ago

What do you want to change?

The SQLite docs mentions that "The ON CONFLICT clauses are checked in the order specified", implying that there can be multiple conflict targets in an upsert statement which is not the case in sqlc. Currently, the SQLite parser will fail to parse queries that contain multiple conflict targets.

This gist contains the output of sqlc verify against a query, schema, and config file to demonstrate the issue.

What database engines need to be changed?

SQLite

What programming language backends need to be changed?

Go

mikeschinkel commented 2 weeks ago

@maxsei — Ironically, I ran into this exact same need a few days ago. 🤷‍♂️