Skip site navigation (1) Skip section navigation (2)

Re: Problem with API (libpq) - detailed error codes

From: ljb <ljb220(at)mindspring(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with API (libpq) - detailed error codes
Date: 2004-01-31 00:58:53
Message-ID: bveukd$2fth$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-general
Adam(dot)Bukla(at)interia(dot)pl wrote:
>...
>
> If function PQexec fails, I can get error code using PQresultStatus.
> But returned codes are very generally and do not specify what really
> happen. I can get detailed error description using PQerrorMessage
> function, but I need detailed error code (number).
>
> For instance, if I create table, I would like to know, that operation
> failed because:
> - table already exist
> - sql syntax error
> - invalid columnt type
> and so on.
>
> I searched documents about libpq API and even header file
> 'internal/libpq-int.h' but I didn't found any interesting.
>
> I would be very gracefully for any hint.

Appendix A of the PostgreSQL 7.4.1 Reference Manual has a list of error
codes (5 digit numbers) and their meanings. You get at the error code
with PQresultErrorField(result, PG_DIAG_SQLSTATE).

In response to

pgsql-general by date

Next:From: Martijn van OosterhoutDate: 2004-01-31 01:06:47
Subject: Re: DB cache size strategies
Previous:From: Martijn van OosterhoutDate: 2004-01-31 00:51:17
Subject: Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group