Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage - Mailing list pgsql-sql

From Tom Lane
Subject Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage
Date
Msg-id 4478.1413390995@sss.pgh.pa.us
Whole thread Raw
Responses Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage  ("Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar@cisco.com>)
List pgsql-sql
"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-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: could not access status of transaction pg_multixact issue
Next
From: "Roopeshakumar Narayansa Shalgar (rshalgar)"
Date:
Subject: Re: [GENERAL] Any postgres API available to get errorcode for PQerrorMessage