INSERT ... ON CONFLICT ... : expose INSERT vs UPDATE status

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

INSERT ... ON CONFLICT ... : expose INSERT vs UPDATE status

George MacKerron-2
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:

  https://www.postgresql.org/message-id/1565486215.7551.0%40finefun.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