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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>
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-26 14:34:22
Message-ID: 14207.1432650862@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com> writes:
> I have a question about txid_current().
> it is "Why does txid_current() assign new transaction-id?".

Consider

begin;
select txid_current();
insert into my_table ...;
commit;

If we changed the code as you propose, the result of the SELECT would
no longer have anything to do with the XID used for the insertion.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-05-26 14:41:12 Re: fsync-pgdata-on-recovery tries to write to more files than previously
Previous Message Alvaro Herrera 2015-05-26 14:30:02 Re: brin regression test intermittent failures