I'm trying to figure out if there's a way to use an UPSERT
ON CONSTRAINT
statement in a way that, on conflict, it would update the conflicting record to solve the conflict and afterwards, insert a new record.
Asked
Active
Viewed 21 times
0

zzzzzz
- 1
-
Use `RETURNING` and check the value to see whether the row was inserted with your new values or was updated to resolve the conflict. Then optionally run the second insert. – Bergi Apr 15 '23 at 02:03