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

From: George MacKerron <george(at)mackerron(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: INSERT ... ON CONFLICT ... : expose INSERT vs UPDATE status
Date: 2021-02-23 11:56:03
Message-ID: DE57F14C-DB96-4F17-9254-AD0AABB3F81F@mackerron.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2021-02-23 12:17:32 Re: libpq compression
Previous Message Amit Kapila 2021-02-23 11:53:05 Re: Parallel INSERT (INTO ... SELECT ...)