Re: second DML operation fails with updatable cursor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Dharmendra Goyal <dharmendra(dot)goyal(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: second DML operation fails with updatable cursor
Date: 2007-10-24 18:35:53
Message-ID: 10326.1193250953@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> Yes, re-fetching row you just deleted is supposed to raise an error.
> That doesn't seem very hard to implement. If an UPDATE/DELETE CURRENT OF
> doesn't find the tuple to update/delete, raise an error.

Uh, no, the error would have to come from FETCH RELATIVE 0, and there's
a problem because no single piece of the code has all the facts needed
to know that an error should be thrown. I don't currently see any
non-klugy way to detect that.

It might make sense to go with Simon's suggestion to just forbid
non-forwards fetch from a FOR UPDATE cursor (assuming that we agree he's
read the spec correctly to disallow that). That would mask the problem
cases in a clean way, and we could fix them sometime later as an
enhancement, if anyone finds it worthwhile.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-10-24 18:47:13 Re: second DML operation fails with updatable cursor
Previous Message Heikki Linnakangas 2007-10-24 18:24:51 Re: second DML operation fails with updatable cursor