3 ms·
Good article, but I wouldn't characterize MERGE as strictly better than the older "ON CONFLICT ..." for Postgres, because MERGE doesn't support any sort of RETU
by sixbrx 3y ago
Good article, but I wouldn't characterize MERGE as strictly better than the older "ON CONFLICT ..." for Postgres, because MERGE doesn't support any sort of RETURNING clause.
- majkinetor 3y agoYeah, we were happy to see MERGE in latest postgres but abandoned it after we found there is no RETURNING...
- keosak 3y agoINSERT ... ON CONFLICT has a problem with CHECK constraints. The constraint must be satisfied in the INSERT tuple even if the row already exists and UPDATE will be executed. I recently dealt with this at work and the resulting CTE query was very similar to MERGE, except MERGE has better syntax.
- Nezteb 3y agoI found a post on the mailing list about this: https://www.postgresql.org/message-id/CANbhV-EXmw9i4YhJTgsrLrE-JgUH55MJo6SLCt12mbXjPGuoLA@mail.gmail.com https://www.postgresql.org/message-id/CANbhV-EXmw9i4YhJTgsrL... I'm not sure how to go about making an official feature/change request though.