I wrote:
> It turns out that this is a libpq deficiency: it's got the error
> message, but because PQexec() was used, it's waiting around for
> a 'Z' ReadyForQuery message before it hands the error message
> back to the application. Since the backend crashes, of course
> the 'Z' never comes ... and when libpq detects closure of the
> connection, it wipes out the stored error message in its haste
> to report
> pqReadData() -- backend closed the channel unexpectedly.
> This probably means the backend terminated abnormally
> before or while processing the request.
> which is all that the user gets to see, unless he thinks to
> look in the postmaster log. Boo hiss.
Although I forgot to mention it in the commit log entry, this problem
is fixed in the libpq changes I just committed to the current branch.
regards, tom lane