X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A0E6C4758C9 for ; Thu, 27 Mar 2003 10:32:58 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id C38A0474E44 for ; Thu, 27 Mar 2003 10:32:56 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id h2RFWnV15938; Thu, 27 Mar 2003 10:32:49 -0500 (EST) From: Bruce Momjian Message-Id: <200303271532.h2RFWnV15938@candle.pha.pa.us> Subject: Re: updateable cursors & visibility In-Reply-To: To: Peter Eisentraut Date: Thu, 27 Mar 2003 10:32:49 -0500 (EST) Cc: Neil Conway , Hiroshi Inoue , PostgreSQL Hackers X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/1135 X-Sequence-Number: 37381 Peter Eisentraut wrote: > Bruce Momjian writes: > > > One idea is to require FOR UPDATE on the cursor --- while that prevents > > other transactions from changing the cursor, it doesn't deal with the > > current transaction modifying the table outside the cursor. > > That would only keep existing rows from being deleted but not new rows > from being added. > > > One idea is > > to have UPDATE/DELETE WHERE CURRENT OF behave like UPDATE/DELETE do now > > when they find a row that is locked by another transaction --- they wait > > to see if the transaction commits or aborts, then if committed they > > follow the tid to the newly updated row, check the WHERE clause to see > > if it still is satisfied, then perform the update. (Is this correct?) > > Surely it would have to do something like that, but that's a matter of the > transaction isolation, not the sensitivity. It doesn't do anything to > address the potential problems I mentioned. Well, a unique constraint on the row would see your other INSERT. I don't see how making an INSERT visible in the cursor would help us, and I don't see how we would implement that except by rerunning the query for each fetch, which seems like a bad idea. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073