Re: Should we add xid_current() or a int8->xid cast?

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Mark Dilger <hornschnorter(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Should we add xid_current() or a int8->xid cast?
Date: 2020-04-07 00:14:32
Message-ID: CA+hUKG+5TPg=Z8dwTbRs-CW4GykAocaf5-4dw3Jvy8HwhAJz4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 5, 2020 at 11:31 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Sun, Apr 5, 2020 at 10:34 AM Mark Dilger
> <mark(dot)dilger(at)enterprisedb(dot)com> wrote:
> > The "xid8_" warts are partly motivated by having a type named "xid8", which is a bit of a wart in itself.
>
> Just a thought for the future, not sure if it's a good one: would it
> seem less warty in years to come if we introduced xid4 as an alias for
> xid, and preferred the name xid4? Then it wouldn't look so much like
> xid is the "real" transaction ID type and xid8 is some kind of freaky
> extended version; instead it would look like xid4 and xid8 are narrow
> and wide transaction IDs, and xid is just a historical name for xid4.

I'll look into proposing that for PG14. One reason I like that idea
is that system view names like backend_xid could potentially retain
their names while switching to xid8 type, (maybe?) breaking fewer
queries and avoiding ugly names, on the theory that _xid doesn't
specify whether it's xid4 or an xid8.

> > > pg_current_xact_id()
> > > pg_current_xact_id_if_assigned()
> > > pg_xact_status(xid8)

> > > pg_current_snapshot()
> > > pg_snapshot_xmin(pg_snapshot)
> > > pg_snapshot_xmax(pg_snapshot)
> > > pg_snapshot_xip(pg_snapshot)
> > > pg_visible_in_snapshot(xid8, pg_snapshot)

> > As such, I'm ±0 for the change.
>
> I'll let this sit for another day and see if some more reactions appear.

Hearing no objections, pushed. Happy to reconsider these names before
release if someone finds a problem with this scheme.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-04-07 00:25:02 Re: [HACKERS] Restricting maximum keep segments by repslots
Previous Message Kyotaro Horiguchi 2020-04-07 00:12:43 Re: [HACKERS] Restricting maximum keep segments by repslots