Re: txid_current() forces a real xid

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: txid_current() forces a real xid
Date: 2011-07-11 21:55:52
Message-ID: CACMqXC+HLVyv9exqC=3j_aMx8X0tZG0gAMMHQHRkq=ExCJY1eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 11, 2011 at 5:59 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Right now, calling txid_current() causes a session to create a
> non-virtual xid if not already assigned, so observing the xid creates
> it, which seems kind of odd.  Is that intended?  Here is the C code:

Yes, it was intentional, the value will be written out.

It could be even called before actual writing statement is run
so returning anything that will become invalid later during
transaction is dangerous.

If you have use-case that requires frequent calling of that function
in read-only transaction, and prefer to see virtual txids
I suggest implementing it as new function.

--
marko

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-07-11 22:58:35 TODO list updated
Previous Message Kohei KaiGai 2011-07-11 20:52:43 Re: [v9.1] sepgsql - userspace access vector cache