Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XeRZ8-0006Cg-2I for pgsql-sql@arkaria.postgresql.org; Wed, 15 Oct 2014 16:36:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XeRZ7-0003mJ-68 for pgsql-sql@arkaria.postgresql.org; Wed, 15 Oct 2014 16:36:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XeRZ6-0003mA-G6; Wed, 15 Oct 2014 16:36:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XeRZ2-00063x-0b; Wed, 15 Oct 2014 16:36:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s9FGaZwv004479; Wed, 15 Oct 2014 12:36:35 -0400 From: Tom Lane 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 In-reply-to: References: Comments: In-reply-to "Roopeshakumar Narayansa Shalgar (rshalgar)" message dated "Wed, 15 Oct 2014 08:17:01 -0000" Date: Wed, 15 Oct 2014 12:36:35 -0400 Message-ID: <4478.1413390995@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org "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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql