Re: Adding MERGE to the TODO list (resend with subject)

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, elein <elein(at)varlena(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding MERGE to the TODO list (resend with subject)
Date: 2004-05-09 03:54:05
Message-ID: 20040509035405.GA917@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-05-09 04:13:31 Re: Adding MERGE to the TODO list (resend with subject)
Previous Message Christopher Kings-Lynne 2004-05-09 01:50:00 Re: Adding MERGE to the TODO list (resend with subject)

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-05-09 04:13:31 Re: Adding MERGE to the TODO list (resend with subject)
Previous Message Christopher Kings-Lynne 2004-05-09 01:50:00 Re: Adding MERGE to the TODO list (resend with subject)

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-05-09 04:13:31 Re: Adding MERGE to the TODO list (resend with subject)
Previous Message Christopher Kings-Lynne 2004-05-09 01:50:00 Re: Adding MERGE to the TODO list (resend with subject)