Re: ask for review of MERGE - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: ask for review of MERGE
Date
Msg-id 20101024095009.GA4695@svana.org
Whole thread Raw
In response to Re: ask for review of MERGE  (Greg Stark <gsstark@mit.edu>)
Responses Re: ask for review of MERGE
Re: ask for review of MERGE
List pgsql-hackers
On Sat, Oct 23, 2010 at 03:59:13PM -0700, Greg Stark wrote:
> I think the blocker with MERGE has always been that the standard is
> *so* general that it could apply to conditions that *aren't* covered
> by a unique constraint or exclusion constriant. Personally, I'm fine
> saying that those cases will perform poorly, locking the table, or
> aren't allowed and print a warning explaining exactly what exclusion
> constraint or btree unique index would be necessary to allow it. I
> think virtually every case where people will want to use it will be on
> a primary key anyways.

Can we please not get MERGE hung up on trying to make it atomic. The
standard requires no such thing and there are plenty of uses of MERGE
that don't involve high concurrency updates of the same row by
different processes. If we want an atomic UPSERT, make that a seperate
command, MERGE without atomicity is useful enough already.

Simply, if the row is visible in the current snapshot you do an update
otherwise an insert. If you get an error, raise it. Icing can be added
later.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patriotism is when love of your own people comes first; nationalism,
> when hate for people other than your own comes first.
>                                       - Charles de Gaulle

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: WIP: extensible enums
Next
From: Hsien-Wen Chu
Date:
Subject: Re: PostgreSQL and HugePage