Re: Any postgres API available to get errorcode for PQerrorMessage - Mailing list pgsql-general

From Roopeshakumar Narayansa Shalgar (rshalgar)
Subject Re: Any postgres API available to get errorcode for PQerrorMessage
Date
Msg-id F9567754259D974D88F5F5337C9D219620BD157E@xmb-aln-x11.cisco.com
Whole thread Raw
In response to Any postgres API available to get errorcode for PQerrorMessage  ("Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar@cisco.com>)
Responses Re: Any postgres API available to get errorcode for PQerrorMessage
List pgsql-general
Appreciate any replies on this.

/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


pgsql-general by date:

Previous
From: Steve Wampler
Date:
Subject: Re: COPY data into a table with a SERIAL column?
Next
From: Naveen Krishna
Date:
Subject: How to Install Extensions