Re: [GENERAL] Comparing txid_current() to xmin

2012-11-08 Thread Andres Freund
On Thu, Nov 08, 2012 at 11:47:37AM +0200, Marko Kreen wrote: > On Wed, Nov 7, 2012 at 10:21 AM, Andres Freund wrote: > > On Tue, Nov 06, 2012 at 02:55:40PM -0800, Mike Lewis wrote: > >> I am trying to make a trigger that updates a row once and only once per > >> transaction (even if this trigger g

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-08 Thread Marko Kreen
On Wed, Nov 7, 2012 at 10:21 AM, Andres Freund wrote: > On Tue, Nov 06, 2012 at 02:55:40PM -0800, Mike Lewis wrote: >> I am trying to make a trigger that updates a row once and only once per >> transaction (even if this trigger gets fired multiple times). The general >> idea is that for a user we

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-07 Thread Andres Freund
On Tue, Nov 06, 2012 at 02:55:40PM -0800, Mike Lewis wrote: > I am trying to make a trigger that updates a row once and only once per > transaction (even if this trigger gets fired multiple times). The general > idea is that for a user we have a version number. When we modify the > user's data, t

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Mike Lewis
> > Uh, txid_current returns a 64 bit value, whereas xmin only stores the 32 > least significant bits. They would certainly differ after a xid > wraparound. > > -- > Álvaro Herrerahttp://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > Ah yes...

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Alvaro Herrera
Mike Lewis escribió: > I am trying to make a trigger that updates a row once and only once per > transaction (even if this trigger gets fired multiple times). The general > idea is that for a user we have a version number. When we modify the > user's data, the version number is incremented then s

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Sergey Konoplev
On Tue, Nov 6, 2012 at 2:55 PM, Mike Lewis wrote: > I am trying to make a trigger that updates a row once and only once per > transaction (even if this trigger gets fired multiple times). The general > idea is that for a user we have a version number. When we modify the user's > data, the versio

[GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Mike Lewis
I am trying to make a trigger that updates a row once and only once per transaction (even if this trigger gets fired multiple times). The general idea is that for a user we have a version number. When we modify the user's data, the version number is incremented then set on the object. We only ne