Karsten Hilbert <[EMAIL PROTECTED]> writes:
> 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 ?

I think you can skip the SELECT FOR UPDATE altogether if you do it that
way.  Otherwise it looks fine.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to