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.96) (envelope-from ) id 1w0JE7-001nbO-2x for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 13:03:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0JE6-00942k-1G for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 13:03:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0FlX-008Ail-2p for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 09:22:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w0FlW-00000001aOT-2aIQ for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 09:22:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=YmSu+qjbLDbgRHcD4Y7Z5jFZapIs1G2wd2JzJc1y4LY=; b=o//tXxIEpXPQN+TvEgXv3fzjcE aGmR8nY0+J62vCURrcm2+Tw/KrsfAjrR93fWgP0905iMuf4lbeXRK+fOytFlU71G43eS5y2z8It6Q NzG5nUUMJ5StGMNa9Eh+cmokTOiFDX7Fiqrgwf1v99DoUpuJQylmfiyBuAZJBjyuuJf83QF32Rkzz T0X2hAgS1+YApT+ONBUUIcIbZAYTQp0dGczz9Be3biu8lZr5u8vJqni/BBBa1RabBFr1eHHSLvU+M IpTipTy+/fDF8oOXvGl03q0REB4Wjwo2i88NbgpWfIuOsdoqogsKKa/HJ8kZUB8muzOpDjOC4H8Qi +rEReBDA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0FlU-003q0p-2P for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 09:22:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0FlS-007xWu-1n for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 09:22:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19427: TOAST Snapshot Assertion Failure To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 303677365@qq.com Reply-To: 303677365@qq.com, pgsql-bugs@lists.postgresql.org Date: Wed, 11 Mar 2026 09:21:57 +0000 Message-ID: <19427-44560ddf098e6489@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19427 Logged by: chunling qin Email address: 303677365@qq.com PostgreSQL version: 15.0 Operating system: centos Description: =20 ## Description PostgreSQL crashes with an assertion failure when executing UPDATE statements with RETURNING clause that returns TOAST-compressed data (specifically `pg_node_tree` type from system catalogs). The assertion `HaveRegisteredOrActiveSnapshot()` fails in `init_toast_snapshot()` function. ## Crash Information ### Signal ``` SIGABRT (Assertion failure) ``` ### Stack Trace ``` #0 __pthread_kill_implementation () from /lib64/libc.so.6 #1 raise () from /lib64/libc.so.6 #2 abort () from /lib64/libc.so.6 #3 ExceptionalCondition (conditionName=3D"HaveRegisteredOrActiveSnapshot()= ", errorType=3D"FailedAssertion", fileName=3D"toast_internals.c", lineNumber=3D670) #4 init_toast_snapshot (toast_snapshot=3D0x7ffd01b64e50) at toast_internals.c:670 #5 heap_fetch_toast_slice (toastrel=3D..., valueid=3D12032, attrsize=3D244= 8, sliceoffset=3D0, slicelength=3D2448, result=3D.= ..) at heaptoast.c:688 #6 table_relation_fetch_toast_slice (...) at tableam.h:1892 #7 toast_fetch_datum (attr=3D...) at detoast.c:375 #8 detoast_attr (attr=3D...) at detoast.c:123 #9 pg_detoast_datum_packed (datum=3D...) at fmgr.c:1757 #10 text_to_cstring (t=3D...) at varlena.c:225 #11 textout (fcinfo=3D...) at varlena.c:574 #12 pg_node_tree_out (fcinfo=3D...) at pseudotypes.c:354 #13 FunctionCall1Coll (...) at fmgr.c:1138 #14 OutputFunctionCall (...) at fmgr.c:1575 #15 printtup (...) at printtup.c:357 ``` ## Reproduction ### Minimal Test Case ```sql -- Case 1: UPDATE system catalog with RETURNING TOAST column UPDATE pg_catalog.pg_rewrite SET rulename =3D rulename WHERE oid =3D (SELECT oid FROM pg_catalog.pg_rewrite LIMIT 1) RETURNING ev_action; -- Case 2: UPDATE with subquery returning TOAST data CREATE TABLE test_table (id int, col_varchar varchar); INSERT INTO test_table VALUES (1, 'test'); UPDATE test_table SET id =3D id RETURN id, (SELECT ev_action FROM pg_catalog.pg_rewrite LIMIT 1) AS ev_action; ```