Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Michael Paquier <michael@paquier.xyz>, Jim Nasby <nasbyj@amazon.com>, pgsql-hackers@lists.postgresql.org
Date: 2021-06-23T04:07:11Z
Lists: pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> This causes the server to crash during FETCH.

> ts=# begin; declare b cursor for VALUES(1); fetch 100 in b;
> BEGIN
> DECLARE CURSOR
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.

Hm, works for me:

regression=# begin; declare b cursor for VALUES(1); fetch 100 in b;
BEGIN
DECLARE CURSOR
 column1 
---------
       1
(1 row)

			regards, tom lane



Commits

  1. Restore the portal-level snapshot for simple expressions, too.

  2. Centralize the logic for protective copying of utility statements.

  3. Restore the portal-level snapshot after procedure COMMIT/ROLLBACK.

  4. Avoid taking a new snapshot for an immutable simple expression in plpgsql.