Re: Adding MERGE to the TODO list (resend with subject) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Adding MERGE to the TODO list (resend with subject)
Date
Msg-id 20040509035405.GA917@dcc.uchile.cl
Whole thread Raw
In response to Re: Adding MERGE to the TODO list (resend with subject)  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Responses Re: Adding MERGE to the TODO list (resend with subject)  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-hackers
On Sun, May 09, 2004 at 09:50:00AM +0800, Christopher Kings-Lynne wrote:
> >What does the MERGE command do?  I have never heard of it, so I doubt
> >someone is working on it.
> 
> It is basically the SQL standard version of MySQL's REPLACE syntax.  It 
> does an update-else-insert set.  However, the trick is that it uses some 
> sort of next key locking to ensure that it cannot fail.  Something that 
> is impossible to do in PostgreSQL at the moment. Nested transactions 
> will help, however.

I intend to release locks on subtransaction abort, so if the update
fails there's room for another transaction to insert the key (which I
understand should fail?).  I guess there's a different locking mechanism
needed; I believe nested transactions will not be enough.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The first of April is the day we remember what we are
the other 364 days of the year"  (Mark Twain)


pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: Adding MERGE to the TODO list (resend with subject)
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Adding MERGE to the TODO list (resend with subject)