From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | "Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar(at)cisco(dot)com>, "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: Any postgres API available to get errorcode for PQerrorMessage |
Date: | 2014-10-16 20:09:40 |
Message-ID: | 54402604.2010907@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
On 10/16/2014 12:09 AM, Roopeshakumar Narayansa Shalgar (rshalgar) wrote:
> Appreciate any replies on this.
It has been answered, see Tom Lanes link below. In particular you are
looking for PG_DIAG_SQLSTATE.
>
> /rK
>
> -----Original Message-----
> From: Roopeshakumar Narayansa Shalgar (rshalgar)
> Sent: Wednesday, October 15, 2014 10:19 PM
> To: 'Tom Lane'; pgsql-sql(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org
> Subject: RE: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage
>
> Thanks Tom,
>
> But that's not what I am looking for.
>
> I need the 'integer' errorcode equivalent of " errormsg string" returned by PQerrorMessage.
>
> /rK
>
> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Wednesday, October 15, 2014 10:07 PM
> To: Roopeshakumar Narayansa Shalgar (rshalgar)
> Cc: pgsql-sql(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage
>
> "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
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2014-10-16 20:22:54 | Re: COPY data into a table with a SERIAL column? |
Previous Message | Emi Lu | 2014-10-16 20:04:37 | CopyManager(In/out) vs. delete/insert directly |
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Dudgeon | 2014-10-30 14:55:36 | querying within json |
Previous Message | Roopeshakumar Narayansa Shalgar (rshalgar) | 2014-10-16 07:09:54 | Re: Any postgres API available to get errorcode for PQerrorMessage |