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

From Tom Lane
Subject Re: Transaction ID in Triggers
Date
Msg-id 22497.1250280496@sss.pgh.pa.us
Whole thread Raw
In response to Transaction ID in Triggers  (David Saracini <dsaracini@yahoo.com>)
Responses Re: Transaction ID in Triggers  (Greg Stark <gsstark@mit.edu>)
Re: Transaction ID in Triggers  (David Saracini <dsaracini@yahoo.com>)
List pgsql-novice
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 better
audittrail 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().

            regards, tom lane

pgsql-novice by date:

Previous
From: David Saracini
Date:
Subject: Transaction ID in Triggers
Next
From: Greg Stark
Date:
Subject: Re: Transaction ID in Triggers