public inbox for [email protected]  
help / color / mirror / Atom feed
From: Shinya Kato <[email protected]>
To: Tom Lane <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Use pg_current_xact_id() instead of deprecated txid_current()
Date: Mon, 9 Feb 2026 21:07:03 +0900
Message-ID: <CAOzEurTHVoxj=O_QxDsC+wE3Gcyj+5q6Jt-C-VXTZyW939UX5Q@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAOzEurQetW=-1+OnMo8baeVQF=-kAr-wNtFcgRNo+ErPk=xsDQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>

On Mon, Feb 9, 2026 at 1:24 AM Tom Lane <[email protected]> wrote:
>
> =?UTF-8?Q?=C3=81lvaro_Herrera?= <[email protected]> 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.

Got it. I’ll give it a try, thanks.

> As things stand, I don't find the proposed patch to be an improvement.

I agree that casting xid8 to bigint was not the right approach.
However, I still believe it's important to move away from using
deprecated functions.

-- 
Best regards,
Shinya Kato
NTT OSS Center






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Use pg_current_xact_id() instead of deprecated txid_current()
  In-Reply-To: <CAOzEurTHVoxj=O_QxDsC+wE3Gcyj+5q6Jt-C-VXTZyW939UX5Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox