Re: BUG #18531: err when using 'current of' with incremental COMMIT

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: dzja112@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-07-15T16:07:40Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> That combine 'current of' and 'commit' at one loop is bad idea?

Yeah, that's not going to work.  The first COMMIT auto-holds the
cursor [1], and after that there is not an active cursor query for
the WHERE CURRENT OF to refer to.  Even if that data were somehow
retained, the COMMIT would have dropped the tuple locks taken by
the cursor query, so that the semantics would be a lot squishier
than you'd want.

The discussion at [1] fails to mention that there are any such
gotchas implicit in the auto-hold behavior, so I added a little
bit of text [2].

			regards, tom lane

[1] https://www.postgresql.org/docs/current/plpgsql-transactions.html
[2] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a0899c0a97d19b0c330ff885af4b78b3e7efb100



Commits

  1. Doc: minor improvements for plpgsql "Transaction Management" section.