Mark Gibson <gibsonm@cromwell.co.uk> writes:
> I've been trying to use gdb to trace the problem, but I can't work out
> how to attach gdb to a backend process.
It's not hard. Start psql, then in another window use ps to determine
the PID of the connected backend. (The pg_stat_activity view might help
too.) Then
gdb /path/to/postgres-executable PIDgdb> b whereevergdb> cont
and away you go.
regards, tom lane