Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XerMq-00012k-Lz for pgsql-general@arkaria.postgresql.org; Thu, 16 Oct 2014 20:09:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XerMp-0001zJ-9r for pgsql-general@arkaria.postgresql.org; Thu, 16 Oct 2014 20:09:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XerMn-0001wq-TH for pgsql-general@postgresql.org; Thu, 16 Oct 2014 20:09:46 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XerMk-0000ni-TD for pgsql-general@postgresql.org; Thu, 16 Oct 2014 20:09:44 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by gateway2.nyi.internal (Postfix) with ESMTP id 46D6C20907 for ; Thu, 16 Oct 2014 16:09:42 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Thu, 16 Oct 2014 16:09:42 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= x-sasl-enc:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=mesmtp; bh=27CbMeYldcMJRtjcbiMOPWbAVYE=; b=NFT+Zp9jrnqJGhtvKT hhjU8S7iHhBwI4uw8ie07dZPL4A4DXl5OeZWfzB3Z0i+Qwn/iUnfYgPHHn+IlC9H mx7IwhDSsZjxsC5CQ1moRgqIExty92tb3g6/uiu9WUIHf+1Fz2JYn8T5Ux6zIR1b 5I8QKWD05D622mlpjwNUL68wg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=27CbMeYldcMJRtjcbiMOPW bAVYE=; b=MzdjK8SbnNL6RFva8/ZTLPSyu7pvoHaKCvJLAz7yAZbGMveCPLoRXT ygksNGJY5pNIgysy6foFhBDi6fpEdzoqxv1hJi6YdgZ4lFB7tewHo7rD9nXZXNQh wlQjiAFdycxVIw5D7htOE5e0CnuFzXCiCEQkhqh7KX2YeLmZJWRu8= X-Sasl-enc: ywRHGCQKhQTV8kb+jalrqRQtTirhJLTVjMOjrTAXBjz/ 1413490181 Received: from killi.site (unknown [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id 96411680038; Thu, 16 Oct 2014 16:09:41 -0400 (EDT) Message-ID: <54402604.2010907@aklaver.com> Date: Thu, 16 Oct 2014 13:09:40 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: "Roopeshakumar Narayansa Shalgar (rshalgar)" , "pgsql-sql@postgresql.org" , "pgsql-general@postgresql.org" Subject: Re: Any postgres API available to get errorcode for PQerrorMessage References: <4478.1413390995@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org 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)" 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