Re: Why would query return PGRES_NONFATAL_ERROR? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why would query return PGRES_NONFATAL_ERROR?
Date
Msg-id 27233.1081533194@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why would query return PGRES_NONFATAL_ERROR?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why would query return PGRES_NONFATAL_ERROR?
List pgsql-general
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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why would query return PGRES_NONFATAL_ERROR?
Next
From: Scott Ribe
Date:
Subject: Re: Why would query return PGRES_NONFATAL_ERROR?