Re: Transaction ID in Triggers - Mailing list pgsql-novice

From Greg Stark
Subject Re: Transaction ID in Triggers
Date
Msg-id 407d949e0908141325g10578e48ic830df96297787d0@mail.gmail.com
Whole thread Raw
In response to Re: Transaction ID in Triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
On Fri, Aug 14, 2009 at 9:08 PM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
> David Saracini <dsaracini@yahoo.com> writes:
>> Is there a way to find out the current transaction id from within a Trigger?  I'm interested in implementing a
betteraudit trail mechanism and this would help me greatly. 
>
> If you have your hands on a row that was inserted or updated by the
> current transaction, you could look at its xmin.  Another possibility
> (in recent releases) is to take the low-order 32 bits of txid_current().

For an auditing mechanism you probably just want to use the whole of
txid_current() anyways.

--
greg
http://mit.edu/~gsstark/resume.pdf

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Transaction ID in Triggers
Next
From: David Saracini
Date:
Subject: Re: Transaction ID in Triggers