Re: why does txid_current() assign new transaction-id?

From: Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Christoph Berg <myon(at)debian(dot)org>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: Re: why does txid_current() assign new transaction-id?
Date: 2015-05-27 08:13:22
Message-ID: 116262CF971C844FB6E793F8809B51C6E8D538@BPXM02GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for comments.

I understand your points.

For only to read a current transaction-id, I know we just have to use
txid_current_snapshot and that is a best way, but I feel a little bit
hassle to explain columns of txid_current_snapshot for my supporting customers..
(Xmin is .... and Xmax is ....) ..

> txid_current has had the behavior of assigning a new transaction XID
> when one is not assigned since its introduction. I don't think that it
> is wise to change it now the way you do as many applications surely
> rely on this assumption. Perhaps we could make the documentation
> clearer about those things though, changing the description of this
> function to "get current transaction ID, and assign a new one if one
> is not assigned yet":
> http://www.postgresql.org/docs/devel/static/functions-info.html
+1

I think that a description of txid_current is too rough and it might
be confused some users.
txid_current is a different operation depending on session situations,
I feel if detail of txid_current is documented then it will be better.

For example...
Inside of the transaction-block(begin..end), returns a transaction-id used by this block.
Outside of the transaction-block, returns a next transaction-id(but it is consumed by this function).

Regards,

Naoya

---
Naoya Anzai
Engineering Department
NEC Solution Inovetors, Ltd.
E-Mail: nao-anzai(at)xc(dot)jp(dot)nec(dot)com
---

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2015-05-27 10:02:41 Re: about lob(idea)
Previous Message Dean Rasheed 2015-05-27 07:11:16 Re: [COMMITTERS] pgsql: Row-Level Security Policies (RLS)