Re: BUG #19085: Using EXECUTE to run a multi-statement SQL string causes an assertion failure
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: wangsiyan2@huawei.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-10-14T05:34:05Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes: > The issue is triggered by a PL/pgSQL procedure that dynamically executes a > multi-statement SQL string via EXECUTE, combining DECLARE CURSOR and FETCH > (e.g., "DECLARE test_cursor_1_1 CURSOR FOR SELECT * FROM test_table_1; FETCH > 200 FROM test_cursor_1_1"). This fails with > Assert(ActiveSnapshot->as_snap->regd_count == 0) in snapmgr.c:754 because > the snapshot's registration count (regd_count) reaches 2 during SPI's > multi-statement processing loop. I cannot reproduce this assertion, either in master or REL_18_STABLE branch tip. Are you testing community Postgres, or some locally modified version? regards, tom lane