* Tom Lane <tgl@sss.pgh.pa.us> [Thu, 12 Feb 2009 19:10:34 -0500]:
> [ shrug... ] The "implementation artifact" is that you didn't get a
> deadlock *earlier*.
I agree that such behavior is more plain rather than current.
> You can't expect to update referenced rows and
> referencing rows in the same transaction and not risk deadlock against
> other transactions doing the same thing.
No. One transaction works with referenced rows only. Another with
referencing rows only.
I expect predictability, then flexibility (locks optimization).
So what is your recommendation?
To avoid deadlock do I need lock all referencing rows if I need to
update referenced row(s)?
Something like ` select * from bill1 where pid = 1 or aid = 1 for
update; ` in the first session of example?