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 1ujimY-00BEvU-Nj for pgsql-general@arkaria.postgresql.org; Wed, 06 Aug 2025 18:22:35 +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 1ujimX-000Adq-O3 for pgsql-general@arkaria.postgresql.org; Wed, 06 Aug 2025 18:22:33 +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 1ujimX-000Adi-Ct for pgsql-general@lists.postgresql.org; Wed, 06 Aug 2025 18:22:33 +0000 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ujimV-0016zc-0E for pgsql-general@lists.postgresql.org; Wed, 06 Aug 2025 18:22:33 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 20B677A010D; Wed, 6 Aug 2025 14:22:30 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 06 Aug 2025 14:22:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1754504549; x=1754590949; bh=Iask92ctnf7eSpvv/9LpZadDeMo6xbuo9LZ3qWAyMdk=; b= DMU6y4sJl4GXSh2drChAfGi3YYvBvLjTVZSr1bddVgKEBudnyiLTJaUe9jV8siOO yjSDgjzPGGPDJYrlHNznUUWcX6txlWFwjH3B4QmW1S1iqtMG1DwtzLq5JrYpZKeq eVXB72gX0C/eAdP3NkHXhY8cQsRuSYj1Tqz4Ze7wDIzvwwIZS7rzb54SIaMWHo7U t0FRyWRSIwFd/7N1ORx4jo7q4L2Bt8UUTC+3DLbqFRYDxDEPZK9SuLI3ZOKKyFC4 7SXCJH9hu/cxDAG39bKG2ZukNfMwRbZhLQJErJvXD0kG3RD6onWnWjupm9gDB//E XXq9vh0s3zXGZdjOwcCtNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1754504549; x=1754590949; bh=I ask92ctnf7eSpvv/9LpZadDeMo6xbuo9LZ3qWAyMdk=; b=lFG6PAHcNw1Yl5Gmm D2Y4t0N2aeiZnsc1xk/xToS8cugSOR7WLKs1JysqESMI5DaMhBwk2wNy/efMF9JJ bK01/4NLoDRuqHMM9CesVnTqFkUC5cmsnwFtFVlxMGonZHXn01leS6V30UUfJH6i yjTqdbezZ3Nv0MlWtQTOgipbjO2ufjND+X8knv5zzdm/VFYL0TrLJSrWHZkxP7kG el4FkfGbup95Zzqj+Uk7ahYIFGGI5UQwiJmR7iq8MVHo4qK4POI3ulFnnNhnGs6w dbIstzO+8VP68a0xkQWk7igRAHxYka0Wt1RoCtXhQHOGLWl8rKRMUc3945hum4by fxmNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudekjeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertd dtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepffelgeeifefgve duhedthfekuedtffejveegffegjeevtdehgfduieetfeehjeehnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepqhihqhhgphhofigvrhesghhmrghilhdrtghomhdprhgtphhtth hopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhr gh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Aug 2025 14:22:29 -0400 (EDT) Message-ID: <1f99e5c1-a203-4441-aa5c-33a3baaf852c@aklaver.com> Date: Wed, 6 Aug 2025 11:22:28 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: When UPDATE a row in a table with BEFORE ROW UPDATE trigger, the XMAX of new tuple is set to current XID To: Charles Qi , pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/6/25 05:37, Charles Qi wrote: > And if we do the updates in multiple subtransactions, multixact will be > created, which is not created when the BEFORE ROW UPDATE trigger is absent. > > Is this behavior by design? If so, what is the purpose for the behavior? I would say this is by design. My reasoning is that the savepoints are essentially rollback points and the state of the tuple would need to be saved for each potential rollback. Hence a different transaction id for each savepoint. > > Tested version: > PostgreSQL 14.18 (Ubuntu 14.18-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, > compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit > > The attached file reproduce.sql can be used to reproduce the behavior. -- Adrian Klaver adrian.klaver@aklaver.com