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

From: "Roopeshakumar Narayansa Shalgar (rshalgar)" <rshalgar(at)cisco(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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:48:36
Message-ID: F9567754259D974D88F5F5337C9D219620BD0F23@xmb-aln-x11.cisco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2014-10-15 17:21:53 Re: Any postgres API available to get errorcode for PQerrorMessage
Previous Message Rob Sargent 2014-10-15 16:37:32 Re: Any postgres API available to get errorcode for PQerrorMessage

Browse pgsql-sql by date

  From Date Subject
Next Message John R Pierce 2014-10-15 17:21:53 Re: Any postgres API available to get errorcode for PQerrorMessage
Previous Message Rob Sargent 2014-10-15 16:37:32 Re: Any postgres API available to get errorcode for PQerrorMessage