gateley(at)jriver(dot)com writes:
> About 1 time out of 20, the call
> to PGconnectdb fails with a segfault signal.
Well, you've already got some pretty severe problems then. Seems to me
you ought to track down the reason for this failure before worrying
about cosmetic issues like an ungraceful disconnect.
I suggest compiling both libpq and your app with -g and extracting a
backtrace from the core file produced by the segfault ...
regards, tom lane