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 1vp7bl-001dXV-0R for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Feb 2026 16:26:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vp7ak-008Ael-2n for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Feb 2026 16:24:58 +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 1vp7ak-008Aed-1p for pgsql-hackers@lists.postgresql.org; Sun, 08 Feb 2026 16:24:58 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vp7ad-000000019Q0-25vY for pgsql-hackers@lists.postgresql.org; Sun, 08 Feb 2026 16:24:52 +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 618GOiOI2645119; Sun, 8 Feb 2026 11:24:45 -0500 From: Tom Lane To: =?UTF-8?Q?=C3=81lvaro_Herrera?= cc: "Shinya Kato" , pgsql-hackers Subject: Re: Use pg_current_xact_id() instead of deprecated txid_current() In-reply-to: <9697ad60-ec88-4446-89c1-dc02a3b8e89c@app.fastmail.com> References: <9697ad60-ec88-4446-89c1-dc02a3b8e89c@app.fastmail.com> Comments: In-reply-to =?UTF-8?Q?=C3=81lvaro_Herrera?= message dated "Sun, 08 Feb 2026 11:50:24 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2645117.1770567884.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 08 Feb 2026 11:24:44 -0500 Message-ID: <2645118.1770567884@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =3D?UTF-8?Q?=3DC3=3D81lvaro_Herrera?=3D writes: > On 2026-02-08, Shinya Kato wrote: >> Since pg_current_xact_id() returns xid8 which does not support >> arithmetic operators, places that need "xid + 1" cast the result via >> ::text::bigint first. > I think it may be better to add some operators, or was there a rationale= for these not being there? I'm fairly concerned about overloading the arithmetic operators with unsigned versions. The reason we never invented SQL-level uint8 and such is fear of getting a lot of "ambiguous operator" errors. Now, if we are careful not to create implicit casts between xid[8] and any ordinary type, maybe it'd be okay to invent xid+int, xid8-int, and a few more. As things stand, I don't find the proposed patch to be an improvement. regards, tom lane