INSERT ... ON CONFLICT ... : expose INSERT vs UPDATE status
Started by George MacKerronalmost 5 years ago1 messages
Hi all. I have a library that helps with querying Postgres from TypeScript, and a user just filed this issue:
https://github.com/jawj/zapatos/issues/74
The library uses the xmax method (ubiquitous on Stack Overflow) to detect whether an upsert query resulted in an insert or an update. It seems this is unreliable.
A request was made back in 2019 for an official method to be implemented, but as far as I can see it got no replies and is not on any roadmap:
/messages/by-id/1565486215.7551.0@finefun.com.au
This is a +1 for that request.
I’ve not previously contributed to Postgres, but if nobody else wants to take this on I might be willing to try, ideally with a bit of guidance on where to look and what to do.
All the best,
George