Vlad Arkhipov <arhipov@dc.baikal.ru> writes:
> In a BEFORE UPDATE trigger I need to know whether the row was previously
> modified by this transaction. Is it safe to use xmin and txid_current()
> for this purpose (xmin is 32-bit txid type but txid_current() returns
> 64-bit bigint).
> IF OLD.xmin = txid_current() THEN
Comparing to txid_current() mod 2^32 would probably work, but note this
will not think that subtransactions or parent transactions are "this
transaction", so any use of savepoints or plpgsql exception blocks is
likely to cause headaches. Why do you think you need to know this?
regards, tom lane