Should we add xid_current() or a int8->xid cast? - Mailing list pgsql-hackers

From Andres Freund
Subject Should we add xid_current() or a int8->xid cast?
Date
Msg-id 20190725000636.666m5mad25wfbrri@alap3.anarazel.de
Whole thread Raw
Responses Re: Should we add xid_current() or a int8->xid cast?  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
Hi,

we have txid_current(), which returns an int8. But there's no convenient
way to convert that to type 'xid'. Which is fairly inconvenient, given
that we expose xids in various places.

My current need for this was just a regression test to make sure that
system columns (xmin/xmax in particular) don't get broken again for ON
CONFLICT. But I've needed this before in other scenarios - e.g. age(xid)
can be useful to figure out how old a transaction is, but age() doesn't
work with txid_current()'s return value.

Seems easiest to just add xid_current(), or add a cast from int8 to xid
(probably explicit?) that handles the wraparound logic correctly?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Compile from source using latest Microsoft Windows SDK
Next
From: Peter Geoghegan
Date:
Subject: Re: ON CONFLICT (and manual row locks) cause xmax of updated tuple tounnecessarily be set