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)

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to