Re: Use pg_current_xact_id() instead of deprecated txid_current() - Mailing list pgsql-hackers

From Shinya Kato
Subject Re: Use pg_current_xact_id() instead of deprecated txid_current()
Date
Msg-id CAOzEurRVzxEDKgXc4BF4tnMXpKt2TNW9K4wDNTQyuj-E0OtiZA@mail.gmail.com
Whole thread
In response to Re: Use pg_current_xact_id() instead of deprecated txid_current()  (Álvaro Herrera <alvherre@kurilemu.de>)
List pgsql-hackers
On Sun, Feb 8, 2026 at 7:50 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
>
> 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?

Thank you for your comment!
I don't have a strong opinion on this, but according to [0], xid8 was
intentionally designed not to support arithmetic.

[0] https://www.postgresql.org/message-id/CA%2BhUKGL0TKUm3g8dywe6zVeSJLkaRYet1CgXMsB%2BF3bXJRJHFA%40mail.gmail.com

--
Best regards,
Shinya Kato
NTT OSS Center



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Use pg_current_xact_id() instead of deprecated txid_current()
Next
From: Henson Choi
Date:
Subject: Re: Row pattern recognition