Re: Making joins involving ctid work for the benefit of UPSERT

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making joins involving ctid work for the benefit of UPSERT
Date: 2014-07-18 18:23:32
Message-ID: 20140718182332.GC29260@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-07-18 11:14:34 -0700, Peter Geoghegan wrote:
> On Fri, Jul 18, 2014 at 11:06 AM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> > I don't see why you'd need such a node at all if we had a fully builtin
> > UPSERT. The whole stuff with ON CONFLICT SELECT FOR UPDATE and then
> > UPDATE ... FROM c CONFLICTS is too complicated and exposes stuff that
> > barely anybody will understand, let alone use correctly in queries they
> > write themselves.
>
> I accept that there will be a need for certain restrictions. Most
> obviously, if you update the target table referencing a CTE like this,
> not using the special CONFLICTS clause in the UPDATE (or DELETE) is an
> error. And as I mentioned, you may only join the projected duplicates
> to the UPDATE ModifyTable - an attempt to join any more relations is
> an error. In short, this *is* a fully built-in upsert.

Meh. A understandable syntax wouldn't require the pullups with a special
scan node and such. I think you're attempting a sort of genericity
that's making your (important!) goal much harder to reach.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-07-18 18:32:55 Re: Making joins involving ctid work for the benefit of UPSERT
Previous Message Petr Jelinek 2014-07-18 18:20:32 Re: Built-in binning functions