Re: Use pg_current_xact_id() instead of deprecated txid_current()

From: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use pg_current_xact_id() instead of deprecated txid_current()
Date: 2026-02-08 12:27:10
Message-ID: CAOzEurRVzxEDKgXc4BF4tnMXpKt2TNW9K4wDNTQyuj-E0OtiZA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 8, 2026 at 7:50 PM Álvaro Herrera <alvherre(at)kurilemu(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-02-08 16:05:10 Re: Row pattern recognition
Previous Message Álvaro Herrera 2026-02-08 10:50:24 Re: Use pg_current_xact_id() instead of deprecated txid_current()