Re: [PATCH] Make ON CONFLICT DO NOTHING and ON CONFLICT DO UPDATE consistent

From: "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: [PATCH] Make ON CONFLICT DO NOTHING and ON CONFLICT DO UPDATE consistent
Date: 2023-03-01 19:42:14
Message-ID: CAM-w4HMc95VxOhdQQiapEVM5HA0_FSss=Psr6BmyxVoTe-eBfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 9 Feb 2023 at 05:43, Aleksander Alekseev
<aleksander(at)timescale(dot)com> wrote:
>
> >> I don't buy your argument about DO UPDATE needing to be brought into
> >> line with DO NOTHING. In any case I'm pretty sure that Tom's remarks
> >> in 2016 about a behavioral inconsistencies (which you cited) actually
> >> called for making DO NOTHING more like DO UPDATE -- not the other way
> >> around.
> >
> > Interesting. Yep, we could use a bit of input from Tom on this one.

I realize there are still unanswered conceptual questions about this
patch but with two votes against it seems unlikely to make much more
progress unless you rethink what you're trying to accomplish and
package it in a way that doesn't step on these more controversial
issues.

I'm going to mark the patch Returned With Feedback. If Tom or someone
else disagrees with Peter and Andres or has some new insights about
how to make it more palatable then we can always revisit that.

> > This of course would break backward compatibility. But we can always
> > invent something like:
> >
> > ```
> > INSERT INTO ..
> > ON CONFLICT DO [NOTHING|UPDATE .. ]
> > [ALLOWING|FORBIDDING] SELF CONFLICTS;
> > ```
> >
> > ... if we really want to.

Something like that might be what I mean about new insights though I
suspect this is overly complex. It looks like having the ON CONFLICT
UPDATE happen before the row is already inserted might simplify things
conceptually but then it might make the implementation prohibitively
complex.

--
Gregory Stark
As Commitfest Manager

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2023-03-01 19:43:09 Re: allow meson to find ICU in non-standard localtion
Previous Message Tomas Vondra 2023-03-01 19:34:08 Re: Memory leak from ExecutorState context?