Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v8Xfy-002Wc1-7C for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Oct 2025 05:34:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v8Xfv-00AUCv-FA for pgsql-bugs@arkaria.postgresql.org; Tue, 14 Oct 2025 05:34:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v8Xfv-00AUCn-6u for pgsql-bugs@lists.postgresql.org; Tue, 14 Oct 2025 05:34:20 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v8Xft-0023jj-2F for pgsql-bugs@lists.postgresql.org; Tue, 14 Oct 2025 05:34:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 59E5Y5B4894013; Tue, 14 Oct 2025 01:34:06 -0400 From: Tom Lane To: wangsiyan2@huawei.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19085: Using EXECUTE to run a multi-statement SQL string causes an assertion failure In-reply-to: <19085-3e215c0d39d3f674@postgresql.org> References: <19085-3e215c0d39d3f674@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 14 Oct 2025 03:59:49 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <894011.1760420045.1@sss.pgh.pa.us> Date: Tue, 14 Oct 2025 01:34:05 -0400 Message-ID: <894012.1760420045@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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