Re: updateable cursors & visibility

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: updateable cursors & visibility
Date: 2003-03-27 15:32:49
Message-ID: 200303271532.h2RFWnV15938@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Gearon 2003-03-27 16:55:26 Re: Solution to UPDATE...INSERT problem
Previous Message Bruce Momjian 2003-03-27 15:29:31 Re: 7.4devel auth failed