On Tue, May 26, 2015 at 4:12 PM, Naoya Anzai <nao-an...@xc.jp.nec.com> wrote:
> 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?

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

Regards,
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to