From: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Question Regarding Locks |
Date: | 2004-10-28 16:15:05 |
Message-ID: | 20041028181505.A2423@hermes.hilbert.loc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Just so that I am not getting this wrong:
> BTW, a handy proxy for "row has not changed" is to see if its XMIN
> system column is still the same as before.
Considering that my business objects remember XMIN from when
they first got the row would the following sequence make sure
I am in good shape ?
begin;
select ... for update;
update ... set ... where
my_pk=<my_pk_value>
AND
xmin=<the_old_xmin>
This should either update 1 row in which case I can commit or
zero rows in which case I need to rollback and handle the merge
conflict. The reasoning would be that the condition
my_pk=my_pk_value would select the row I am interested in
while xmin=the_old_xmin would ensure that row hasn't been
modified.
Am I right or is there a flaw in my thinking ?
Thanks,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
From | Date | Subject | |
---|---|---|---|
Next Message | Marco Colombo | 2004-10-28 16:23:14 | Re: Reasoning behind process instead of thread based |
Previous Message | Tim Vadnais | 2004-10-28 16:14:17 | field incrementing in a PL/pgSQL trigger |
From | Date | Subject | |
---|---|---|---|
Next Message | Reinhard Hnat | 2004-10-28 16:56:04 | Re: ERROR: INSERT has more target columns than expressions |
Previous Message | Sample, Matt (GE Healthcare) | 2004-10-28 15:20:46 | Bulk Loading into posgres 8.0.0 |