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