Re: UPDATE/DELETE XXX WHERE CURRENT OF cursor_name - Mailing list pgsql-hackers

From Tom Lane
Subject Re: UPDATE/DELETE XXX WHERE CURRENT OF cursor_name
Date
Msg-id 11245.1153755808@sss.pgh.pa.us
Whole thread Raw
In response to Re: UPDATE/DELETE XXX WHERE CURRENT OF cursor_name  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> No, a concurrent vacuum can't change that because vacuum can't change
> the page unless it can get a super-exclusive lock on it (which means
> nobody else can have a scan stopped at that page, which is exactly
> what this cursor has).

More to the point, vacuum certainly may not delete a row that's still
visible to any open transaction, which this row would be by definition.
And VACUUM FULL couldn't move it, because it couldn't get exclusive
lock on the table.

You'd probably have to forbid use of WHERE CURRENT for a cursor WITH HOLD
though, since that quite possibly would contain rows that don't exist
anymore.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Better name/syntax for "online" index creation
Next
From: Tom Lane
Date:
Subject: Re: UPDATE/DELETE XXX WHERE CURRENT OF cursor_name