Re:Upsert Lands in PostgreSQL 9.5 – A First Look
by mbreese on Wednesday May 13, 2015 @12:19PM
(#9540049)
The syntax looks inconvenient, but I like it. If you have a conflict, you might not want to just update everything, but only a subset of the fields. With this syntax (verbose as it is), you have the option of explicitly stating what you want to happen in the event of a conflict with no ambiguity. Perhaps there is a place for some shorthand like
ON CONFLICT SET *=*.
But aside from that, for a RDBMS like Postgres, I'd opt for explicit over implicit.
Like SQLite's "INSERT OR REPLACE".
Aside of the transactional benefits that upsert has, it's also convenient in that you don't have to update and then insert, saving a lot of typing in cases where you're not relying on an ORM and still have to work with bulk data where you really don't care about local changes (because there were none).
The syntax for this is a bit inconvenient right now.