Re: How to check whether the row was modified by this transaction before? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: How to check whether the row was modified by this transaction before?
Date
Msg-id 20121206190850.GE20926@awork2.anarazel.de
Whole thread Raw
In response to Re: How to check whether the row was modified by this transaction before?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: How to check whether the row was modified by this transaction before?
List pgsql-hackers
On 2012-12-06 13:59:32 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2012-12-06 15:08:51 -0300, Alvaro Herrera wrote:
> >> 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).
>
> > I wonder if we shouldn't have a function txid_is_current(xid);
>
> Yeah, I was wondering that too, and wanted to know if the OP had a
> use-case that was mainstream enough to justify adding such a function.

I think architectures with an invalidation-queue to external caches (be
it web-proxies or something lower-level) are quite popular. And with the
new NOTIFY or pgq relatively simple. Ad to those its sensible not to
post a single primary key more than once.

Magnus had talks about specifically that on various conferences if that
counts as anything ;)

Mainstreamy enough?

Andres
--Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: why can't plpgsql return a row-expression?
Next
From: Jeff Davis
Date:
Subject: Re: Commits 8de72b and 5457a1 (COPY FREEZE)