From: Alvaro Herrera <alvherre@dcc.uchile.cl>
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: elein <elein@varlena.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Adding MERGE to the TODO list (resend with subject)
Date: Sat, 8 May 2004 23:54:05 -0400
Message-ID: <20040509035405.GA917@dcc.uchile.cl> (raw)
In-Reply-To: <409D8E48.3070805@familyhealth.com.au>
References: <200405082246.i48MkTQ29755@candle.pha.pa.us>
<409D8E48.3070805@familyhealth.com.au>
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alvherre@dcc.uchile.cl, chriskl@familyhealth.com.au, pgman@candle.pha.pa.us, elein@varlena.com, pgsql-hackers@postgresql.org
Subject: Re: Adding MERGE to the TODO list (resend with subject)
In-Reply-To: <20040509035405.GA917@dcc.uchile.cl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox