Tom Lane wrote:
> Vlad Arkhipov <arhi...@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,

I think we should be setting the initial epoch to something other than
zero.  That way, some quick testing would have revealed this problem
immediately.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


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

Reply via email to