David Saracini <dsaracini(at)yahoo(dot)com> writes:
> Is there a way to find out the current transaction id from within a Trigger? I'm interested in implementing a better audit 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().
regards, tom lane