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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dzja112(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18531: err when using 'current of' with incremental COMMIT
Date: 2024-07-15 16:07:40
Message-ID: 3167932.1721059660@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message alvherre 2024-07-15 19:35:13 Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently
Previous Message Aleksander Alekseev 2024-07-15 14:04:19 Re: libpq: unexpected return code from PQexecParams with a DO INSTEAD rule present