Dunno, what does PostgreSQL tell you abou the deadlock? Hopefully it
dumps some sort of stack trace showing you the SQL the deadlocked
transaction was doing?
I'm not familiar with how PostgreSQL handles deadlock, although I was
worrying about such things for Oracle back in
Feb. 2001,
and got some interesting answers.
That link seems to broken unfortunately, but it is still on the
Google cache.