Okay, so one last question on this...
If I do the following, assuming I haven't applied the patch, will it
still result in a deadlock (in other words, does this only happen with
multi-record updates, or can it happen with independent single-record
updates inside transactions)?
THREAD1: THREAD2:
BEGIN;
update txn set ... where txn.terminalid = 1;
BEGIN; update txn set ... where
txn.terminalid= 2;
(I anticipate the next statement will give me a deadlock.)
update txn set ... where txn.terminalid = 2;
update txn set ... where txn.terminalid = 1;
COMMIT;
COMMIT;
Thanks, again!
Tom Lane wrote:
> Matt Mello <alien@spaceship.com> writes:
>
>>I see. One item I forgot to mention ... Both update statements have a
>>where clause containing txn.terminalid=38. Txn.terminalid is a foreign
>>key column in that table (txn.terminalid->terminal.terminalid). Could
>>this be the source of the trouble?
>
>
> Not per se. The problem depends on which rows get updated and in what
> sequence --- the contents of the WHERE clause aren't the issue, except
> insofar as they determine the set of rows to be updated.
>
> regards, tom lane
>
>
--
Matt Mello
512-350-6900