Use pg_current_xact_id() instead of deprecated txid_current()

From: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Use pg_current_xact_id() instead of deprecated txid_current()
Date: 2026-02-08 09:14:37
Message-ID: CAOzEurQetW=-1+OnMo8baeVQF=-kAr-wNtFcgRNo+ErPk=xsDQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Commit 4c04be9b05a [0] introduced xid8-based functions to replace the
txid_XXX family. However, several test files were still using
txid_current() instead of the newer pg_current_xact_id(). Attached
patch replaces all remaining call sites in tests.

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.

[0] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=4c04be9b05ad2ec5acd27c3417bf075c13cab134

--
Best regards,
Shinya Kato
NTT OSS Center

Attachment Content-Type Size
v1-0001-Use-pg_current_xact_id-instead-of-deprecated-txid.patch application/octet-stream 13.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-02-08 10:20:58 Re: Skipping schema changes in publication
Previous Message Robert Haas 2026-02-08 01:30:41 Re: Add 64-bit XIDs into PostgreSQL 15