I said:
> Hmm ... PGRES_NONFATAL_ERROR is only used for reporting NOTICE messages
> coming from the backend, and AFAICS such a result should never be
> returned out of PQexec; it's only passed to the notice-message receiver.
Wait, forget that; it's based on looking at CVS tip code :-(
In 7.3 there is only one use of PGRES_NONFATAL_ERROR, and it's this:
ExecStatusType
PQresultStatus(const PGresult *res)
{
if (!res)
return PGRES_NONFATAL_ERROR;
return res->resultStatus;
}
So what you're seeing is a NULL PGresult pointer. (7.4 uses
PGRES_FATAL_ERROR for this case, which I think is saner.)
The most likely causes for a NULL result from PQexec would be
out-of-memory or failure to send the query due to communication
failure. Although PQresultErrorMessage can tell you nothing
(since there is no result), you should find something informative
in the connection's error status (PQerrorMessage).
regards, tom lane