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

From David Saracini
Subject Re: Transaction ID in Triggers
Date
Msg-id 877740.35913.qm@web180311.mail.gq1.yahoo.com
Whole thread Raw
In response to Re: Transaction ID in Triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Transaction ID in Triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi Tom,

Thank you for the quick reply.  Unfortunately, I have a couple of more questions.  :)

So, if I understand it...  then, txid_current returns the xmax in the high-order and the xmin in the low-order.  Correct?  and the xmax is the transaction that deleted the tuple and the xmin stores the last transaction that (inserted or modified).  Correct?

Thanks - and Regards,

David


From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Saracini <dsaracini@yahoo.com>
Cc: pgsql novice forum <pgsql-novice@postgresql.org>
Sent: Friday, August 14, 2009 1:08:16 PM
Subject: Re: [NOVICE] Transaction ID in Triggers

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 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

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

pgsql-novice by date:

Previous
From: Greg Stark
Date:
Subject: Re: Transaction ID in Triggers
Next
From: Tom Lane
Date:
Subject: Re: Transaction ID in Triggers