[hackers-jp: 154] Fw: Re: [HACKERS] Adding MERGE to the TODO list (resend with subject)

TANIDA Yutaka tanida @ sra.co.jp
2004年 5月 10日 (月) 16:05:53 JST


谷田です。

MERGE文(updateしてみて、無ければinsert)という命令を追加しようと言う意
図のスレッドです。こういう動作を求める声はたしかに多いような気もしますが
実際の所どうなんでしょう?

あと、以下の部分が気になります。

> I intend to release locks on subtransaction abort

今手元にGray本がないので確かめてないのですが、Nested Transactionの場合は
サブトランザクション中に取得されたロックは、そのトランザクションがabort
しようがcommitしようが親トランザクションが終了するまで取得され続けなけれ
ばならないと思っていたのですが、どうなんでしょうか?


Forwarded by TANIDA Yutaka <tanida @ sra.co.jp>
----------------------- Original Message -----------------------
 From:    Alvaro Herrera <alvherre @ dcc.uchile.cl>
 To:      Christopher Kings-Lynne <chriskl @ familyhealth.com.au>
 Cc:      Bruce Momjian <pgman @ candle.pha.pa.us>,
          elein <elein @ varlena.com>,
          PostgreSQL-development <pgsql-hackers @ postgresql.org>
 Date:    Sat, 8 May 2004 23:54:05 -0400
 Subject: Re: [HACKERS] Adding MERGE to the TODO list (resend with subject)
----

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


--------------------- Original Message Ends --------------------

-- 
TANIDA Yutaka <tanida @ sra.co.jp>




hackers-jp メーリングリストの案内