Re: meaning of PQresultStatus types

From: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
To: jois(dot)de(dot)vivre(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: meaning of PQresultStatus types
Date: 2006-05-24 13:23:22
Message-ID: 20060524132322.GA191@alamut
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On May 23 11:30, jois(dot)de(dot)vivre(at)gmail(dot)com wrote:
> I'm currently trying to understand how to deal with the return values
> of PGresultStatus in terms of error handling in my application. The
> postgres manual describes the return codes of PGresultStatus as:
>
> PGRES_EMPTY_QUERY: The string sent to the server was empty.
> PGRES_COMMAND_OK: Successful completion of a command returning no data.
> PGRES_TUPLES_OK: Successful completion of a command returning data.
> PGRES_COPY_OUT: Copy Out (from server) data transfer started.
> PGRES_COPY_IN: Copy In (to server) data transfer started.
> PGRES_BAD_RESPONSE: The server's response was not understood.
> PGRES_NONFATAL_ERROR: A nonfatal error (a notice or warning) occurred.
> PGRES_FATAL_ERROR: A fatal error occurred.
>
> My question is, what constitutes a PGRES_FATAL_ERROR or a
> PGRES_BAD_RESPONSE?

AFAIK, at the moment, libpq doesn't return a PGRES_BAD_RESPONSE status
for any operation. (Furthermore, I think there're some situations where
it should do, like in the not understood or incomplete messages in
pqParseInput?() family. I'm also wondering the thoughts of developers
if I'd propose I patch for this.)

To learn more about in which situations libpq turns PGRES_FATAL_ERROR
flag on, you can make a

grep PGRES_FATAL_ERROR -RHn src/interfaces/libpq

call in the PostgreSQL's source directory. (Or better use cscope.)

Regards.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jorge Godoy 2006-05-24 13:26:05 Re: [SQL] (Ab)Using schemas and inheritance
Previous Message Michael Glaesemann 2006-05-24 12:54:25 Re: column order