why does txid_current() assign new transaction-id?

From: Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: why does txid_current() assign new transaction-id?
Date: 2015-05-26 07:12:46
Message-ID: 116262CF971C844FB6E793F8809B51C6E8C7AE@BPXM02GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,hackers!

I have a question about txid_current().
it is "Why does txid_current() assign new transaction-id?".

When we executes txid_current() outside of transaction block, it assigns new transaction-id.
I guess it doesn't need to assign a new txid because txid_current() is just a read-only function.

I found a replaceable function by walking through pg-code, that is GetStableLatestTransactionId(void).

I attached a patch which changing just 1-line.
Could you please check the code?

Regards,

Naoya

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

Attachment Content-Type Size
txid_current.patch application/octet-stream 396 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Naoya Anzai 2015-05-26 07:32:17 Why does txid_current() assign new transaction-id?
Previous Message Shulgin, Oleksandr 2015-05-26 06:50:42 Re: [PATCH] Generalized JSON output functions