Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar(at)cisco(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage
Date: 2014-10-15 16:36:35
Message-ID: 4478.1413390995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar(at)cisco(dot)com> writes:
> HI,
> PQerrorMessage pirints the error message like (no space available,etc). Does postgres provide
> any API which gives the error code listed in the below appendix;

> http://www.postgresql.org/docs/9.1/static/errcodes-appendix.html

Use PQresultErrorField(..., PG_DIAG_SQLSTATE)

http://www.postgresql.org/docs/9.3/static/libpq-exec.html#LIBPQ-EXEC-MAIN

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2014-10-15 16:37:32 Re: Any postgres API available to get errorcode for PQerrorMessage
Previous Message Adrian Klaver 2014-10-15 13:53:45 Re: How to start several PostgreSQL clusters at boot time on a Debian OS

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2014-10-15 16:37:32 Re: Any postgres API available to get errorcode for PQerrorMessage
Previous Message Roopeshakumar Narayansa Shalgar (rshalgar) 2014-10-15 08:17:01 Any postgres API available to get errorcode for PQerrorMessage