Forum OpenACS Development: Re: Deadlock detected (in Postgres 7.3x)
I recently had a situation where an error occurred within db_transaction, and was handled via some custom error reporting code instead of the usual catch mechanism. The error got reported but the database handle never got freed, so other threads started stacking up. It wasn't a deadlock per se, but it was conceptually similar.
I'm wondering if you might be having something similar happening in your script?