To fix it your probably going to have to either track down exactly
what's causing that deadlock, or just keep re-running things until you
get all your data in and the upgrade is done.
Are you by chance updating tables a,b,c in one transaction, and tables
b,c,a in another transaction - same tables but different order?
That's one easy way I know of to generate deadlocks in Oracle, and
annoying because AFAIK there are no tools whatsoever to help you avoid
it, either.
But, this is during a site upgrade, so presumably you have only one
single transaction going at a time, right? Offhand, I can't think of
any way that a single transaction could possibly deadlock itslef, in
fact I believe that's impossible. So something seems weird there...
Oh, btw, I'm thinking in terms of Oracle 8.x here. PostgreSQL should
be basically the same (both use MVCC, etc.) but I'm sure there must be
differences in the details of the two RDBMSs' deadlock detection
algorithms.