agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Adrian Klaver <adrian.klaver@aklaver.com>
To: Roopeshakumar Narayansa Shalgar (rshalgar) <rshalgar@cisco.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Any postgres API available to get errorcode for PQerrorMessage
Date: Thu, 16 Oct 2014 13:09:40 -0700
Message-ID: <54402604.2010907@aklaver.com> (raw)
In-Reply-To: <F9567754259D974D88F5F5337C9D219620BD157E@xmb-aln-x11.cisco.com>
References: <F9567754259D974D88F5F5337C9D219620BD0C43@xmb-aln-x11.cisco.com>
<4478.1413390995@sss.pgh.pa.us>
<F9567754259D974D88F5F5337C9D219620BD157E@xmb-aln-x11.cisco.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
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@postgresql.org; pgsql-general@postgresql.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@sss.pgh.pa.us]
> Sent: Wednesday, October 15, 2014 10:07 PM
> To: Roopeshakumar Narayansa Shalgar (rshalgar)
> Cc: pgsql-sql@postgresql.org; pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage
>
> "Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar@cisco.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.klaver@aklaver.com
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
view thread (8+ messages)
Message-ID: <54402604.2010907@aklaver.com>
Permalink: ../54402604.2010907@aklaver.com/
Also on: postgresql.org/message-id/54402604.2010907@aklaver.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: adrian.klaver@aklaver.com, rshalgar@cisco.com, pgsql-general@postgresql.org
Subject: Re: Any postgres API available to get errorcode for PQerrorMessage
In-Reply-To: <54402604.2010907@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox