| From: | Mike Lewis <mikelikespie(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Comparing txid_current() to xmin |
| Date: | 2012-11-06 22:55:40 |
| Message-ID: | CA+foqsSHYp8YRtRUfR+QSXv1ogQXhy9hNKP2dxDeqmri7odo-w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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 need to increment the version number once.
I am thinking about doing something like:
update user
set version=version+1
where txid_current() != xmin and user_id = 352395;
So I guess my questions are:
How dirty is this?
Will I run into issues?
Is there a better way of doing this?
Thanks,
Mike
--
Michael Lewis
lolrus.org
mikelikespie(at)gmail(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sergey Konoplev | 2012-11-07 00:08:18 | Re: Comparing txid_current() to xmin |
| Previous Message | Bruce Momjian | 2012-11-06 22:43:50 | Re: [GENERAL] fuzzystrmatch module buggy? observations |