Re: INSERT ... ON CONFLICT DO UPDATE

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT DO UPDATE
Date: 2015-07-21 11:05:04
Message-ID: CAEzk6fepiS6Cd4pUfKCp5edzYJoTUjysboNdy=U5_H-hX=UnBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21 July 2015 at 11:43, Rafal Pietrak <rafal(at)ztk-rp(dot)eu> wrote:

> On the other hand, the "ON CONFLICT RETRY" has a nice feature for an
> application programmer (like myself) that it leaves us free of the
> implementation of the re-issue of an INSERT. One database-schema
> designer does that for all of us.
>
> But knowing if that usage scenario is too rare to match the heavy
> lifting the implementation required, is beyond my experience.
>

The usage scenario *is* rare and I'm sure that doesn't help you but the
point is that it's very very easy to write a function that does what you
want. It's not easy at all to write a function that does UPSERT or DO
NOTHING consistently and efficiently.

The fact that you refuse to use the mechanism provided to you by the
database developers doesn't invalidate the fact that that's the simplest
and easiest way to achieve what you want.

I'm sorry to be harsh (again) about this but adding extra complexity to the
PG system to achieve something that is _easily_ achieved through the
existing mechanisms isn't something that is likely to get widespread
support.

Geoff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2015-07-21 12:43:02 Re: Creating a user for pg_start_backup
Previous Message Rafal Pietrak 2015-07-21 10:43:59 Re: INSERT ... ON CONFLICT DO UPDATE