sqlc-dev / sqlc

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

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

Open maxsei opened 5 months ago

maxsei commented 5 months 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 5 months ago

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