Bill Moseley <[email protected]> writes:
> Then when I run the test script (which runs the same transaction in two
> processes at the same time) and get a deadlock the same query is shown twice
> both with "waiting" set true:
> UPDATE account set foo = 123 where id = $1
> And if I remove that update from the transaction I no longer have the
> deadlock.
> So, it seems like that is the problem update.
> Is postgresql telling me that it's deadlocked on two transactions trying to
> run
> that same update?
Looks like it.
> There are no other updates to that account table in the transaction, so I'm
> confused how that is causing a deadlock.
Is there more than one row with the target id? Does the account table
have any foreign-key references to or from it? It's sometimes possible
to get a deadlock associated with trying to lock FK-referenced rows that
several updated rows have in common.
regards, tom lane
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general