Subject Re: Fwd: How to avoid deadlock ?
Author Dmitry Yemanov
15.01.2012 23:58, Vander Clock Stephane wrote:
> now yes it's work like i want ...
> juste one remark, the with lock have a little weakness
> again the equivalent lock with update ...
> ex :
> TranstactionStart
> Insert ... fieldA=1;
> then
> Select ... where FieldA=1 with lock
> => return immediately :(

I don't get the point, sorry. If you perform SELECT in the same
transaction as INSERT, then neither SELECT WITH LOCK nor UPDATE should
wait. If the transactions are different, then both should wait. In this
latter case, SELECT WITH LOCK will not wait only if you have already
updated the record in the same (second) transaction, but again, the same
applies to the regular UPDATE.