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 1w0LzR-001q0q-1n for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 16:00:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0LzP-00A27o-27 for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 16:00:52 +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 1w0LzP-00A27f-1I for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 16:00:51 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w0LzN-00000001dD1-4BbX for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 16:00:51 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4fWFpM2H1CzyTZ; Wed, 11 Mar 2026 18:00:42 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1773244843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DTHNl3g1SFi6C8XjTLluPEhJ9GYEiEWU+bNyxl/Qjgw=; b=MHv5xDiHz145X/tSBXb/zDUrk7ggQieUC03/YJWtUcp/2nQIidriXkIVtdLpMzaWdSgZ14 UNw8VsvCRwePf83MNxgyrs7NNIx9a9kvVX4hw8pvR+FxfOIDXmWM+Bmj976pFiwndNX7QA +9r5bPvk/uKsI74GtQUXPHEOV6WHB+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1773244843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DTHNl3g1SFi6C8XjTLluPEhJ9GYEiEWU+bNyxl/Qjgw=; b=ii5/tz3iYmN788vZMWccTRtjIcu9sEzfCGQi1ANwC/a8Iouk2u0pt8QimoZD6pj50i397W XLOguFBnSyIKkS5TVG/L4hAvsDO/5bymTPxf2uIvccLTfJ03rf0VGiF5N83zRT25jAFy5S M/Bai6grW/1+W87susYIYP7VK2RLsaw= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=meesny; cv=none; t=1773244843; b=bsTWVEa/wWs/YTIueY8JJdkmC7QHGZBTLjmoOCmzrXmA5ikfPU/0PgegSsKDLClnwCUPKF U615TBgUFNXGG0voa1JLXfDPVNmPfE8udSttsT3yuavlbNIsgrnNL1+01Lg8E/Mz7P9oPY Tj2N86TqV4sceV0Gqa0WtVzxsbKF0NI= Message-ID: Date: Wed, 11 Mar 2026 18:00:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19427: TOAST Snapshot Assertion Failure To: 303677365@qq.com, pgsql-bugs@lists.postgresql.org References: <19427-44560ddf098e6489@postgresql.org> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <19427-44560ddf098e6489@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/03/2026 11:21, PG Bug reporting form wrote: > 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 15.13 is the newest on the v15 branch, 15.0 is no longer interesting. Did you mean a later minor version? > Operating system: centos > Description: > > ## 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. Hmm, init_toast_snapshot() was removed in later versions, but the HaveRegisteredOrActiveSnapshot() is still present as a runtime check in the get_toast_snapshot() function that replaced it. > ## 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="HaveRegisteredOrActiveSnapshot()", > errorType="FailedAssertion", > fileName="toast_internals.c", lineNumber=670) > #4 init_toast_snapshot (toast_snapshot=0x7ffd01b64e50) at > toast_internals.c:670 > #5 heap_fetch_toast_slice (toastrel=..., valueid=12032, attrsize=2448, > sliceoffset=0, slicelength=2448, result=...) > at heaptoast.c:688 > #6 table_relation_fetch_toast_slice (...) at tableam.h:1892 > #7 toast_fetch_datum (attr=...) at detoast.c:375 > #8 detoast_attr (attr=...) at detoast.c:123 > #9 pg_detoast_datum_packed (datum=...) at fmgr.c:1757 > #10 text_to_cstring (t=...) at varlena.c:225 > #11 textout (fcinfo=...) at varlena.c:574 > #12 pg_node_tree_out (fcinfo=...) at pseudotypes.c:354 > #13 FunctionCall1Coll (...) at fmgr.c:1138 > #14 OutputFunctionCall (...) at fmgr.c:1575 > #15 printtup (...) at printtup.c:357 > ``` Can you post the full stacktrace, with frames > 15 included, please? > ## Reproduction > > ### Minimal Test Case > ```sql > -- Case 1: UPDATE system catalog with RETURNING TOAST column > UPDATE pg_catalog.pg_rewrite SET rulename = rulename > WHERE oid = (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 = id > RETURN > id, > (SELECT ev_action FROM pg_catalog.pg_rewrite LIMIT 1) AS ev_action; > ``` I cannot reproduce this. Is either one of "Case 1" or "Case 2" supposed to hit the assertion? Or do you need to run both? The latter "UPDATE ... RETURN ..." is incorrect syntax, I presume it's supposed to be "UPDATE ... RETURNING ...". With that it runs without error here. - Heikki