From sandhyar@amiindia.co.in Wed Oct 19 10:19:30 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1EBAEDA20A for ; Wed, 19 Oct 2005 07:19:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13150-07 for ; Wed, 19 Oct 2005 10:19:24 +0000 (GMT) Received: from mars.amiindia.co.in (unknown [203.199.198.229]) by svr1.postgresql.org (Postfix) with ESMTP id A5C81DA21E for ; Wed, 19 Oct 2005 07:19:19 -0300 (ADT) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by mars.amiindia.co.in (8.12.11/8.12.11) with ESMTP id j9JAGNhY015520; Wed, 19 Oct 2005 15:46:24 +0530 Message-ID: <057401c5d497$a25e81e0$cd00000a@amiindiahjwbgh> From: "sandhya" To: "postgre" Cc: "sandhya" Subject: Reg : Error Handling Date: Wed, 19 Oct 2005 15:56:57 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0571_01C5D4C5.BB97F0F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.061 required=5 tests=[AWL=-0.017, FORGED_RCVD_HELO=0.05, HTML_60_70=0.027, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200510/216 X-Sequence-Number: 19288 This is a multi-part message in MIME format. ------=_NextPart_000_0571_01C5D4C5.BB97F0F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In error handling suppose if the database already exists.. It is returning : database "sample(say)" doesn't exists. If i want to return general error messages with out specifying names how = can i? Tell me where can i get the error codes for this instead of messages and = how can i retrieve error no instead of printing message? ------=_NextPart_000_0571_01C5D4C5.BB97F0F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
In error handling suppose if the = database already=20 exists..
 
It is returning : database = "sample(say)" doesn't=20 exists.
 
If i want to return general error = messages with out=20 specifying names how can i?
Tell me where can i get the error codes = for this=20 instead of messages and how can i retrieve error no instead of printing=20 message?
------=_NextPart_000_0571_01C5D4C5.BB97F0F0-- From mike@fuhr.org Wed Oct 19 17:25:18 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 992BCDA661 for ; Wed, 19 Oct 2005 14:25:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74249-03 for ; Wed, 19 Oct 2005 17:25:16 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 5F169DA65E for ; Wed, 19 Oct 2005 14:25:16 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j9JHP9UG094700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Oct 2005 11:25:12 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id j9JHP9Vn073072; Wed, 19 Oct 2005 11:25:09 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id j9JHP7Pk073071; Wed, 19 Oct 2005 11:25:07 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 19 Oct 2005 11:25:07 -0600 From: Michael Fuhr To: sandhya Cc: postgre Subject: Re: Reg : Error Handling Message-ID: <20051019172507.GA72974@winnie.fuhr.org> References: <057401c5d497$a25e81e0$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <057401c5d497$a25e81e0$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/223 X-Sequence-Number: 19295 On Wed, Oct 19, 2005 at 03:56:57PM +0530, sandhya wrote: > In error handling suppose if the database already exists.. > > It is returning : database "sample(say)" doesn't exists. What is "it"? What error handling are you talking about? What are you doing that results in the error, and why does the error message (database doesn't exist) contradict what you first said (database already exists)? Or is that part of what's puzzling you? What does your query or function code (or whatever) look like, and what is the *exact* text of the error message? > If i want to return general error messages with out specifying names how can i? Return error messages from where? > Tell me where can i get the error codes for this instead of > messages and how can i retrieve error no instead of printing message? Please tell us more about what you're doing and what problem you're trying to solve. We don't have enough information to answer your questions without a lot of guessing. Incidentally, I notice that your Subject headers always begin with the word "Reg". What's that about? I've seen it a few other places but have never known what it meant. Anybody? -- Michael Fuhr From sandhyar@amiindia.co.in Thu Oct 20 05:24:36 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A5125D6F4A for ; Thu, 20 Oct 2005 02:24:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80876-09 for ; Thu, 20 Oct 2005 05:24:32 +0000 (GMT) Received: from mars.amiindia.co.in (unknown [203.199.198.229]) by svr1.postgresql.org (Postfix) with ESMTP id 1E8BEDA81C for ; Thu, 20 Oct 2005 02:24:26 -0300 (ADT) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by mars.amiindia.co.in (8.12.11/8.12.11) with ESMTP id j9K5LLo8004159; Thu, 20 Oct 2005 10:51:21 +0530 Message-ID: <00b401c5d537$9503a9d0$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Michael Fuhr" Cc: "postgre" References: <057401c5d497$a25e81e0$cd00000a@amiindiahjwbgh> <20051019172507.GA72974@winnie.fuhr.org> Subject: Re: Reg : Error Handling Date: Thu, 20 Oct 2005 10:30:36 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.047 required=5 tests=[AWL=-0.003, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/226 X-Sequence-Number: 19298 Reg stands for "regarding" Error in the sence ---> I have a function to create a database and so on...... using libpqxx library. And i have a CLInterfacing program through which i can able to select option which i want to do. I am able to get the error messages if anything wrong i give...... But the errors are like below. Say,If i have created a database called "sample" and when i try to give the same database name to create againg it is displaying message like: Database "sample" already exists-->Postgresql format (Here the messages are Specific right) What i want to manipulate is: It should simply display Database already exists --->Format i need (The messages i need to display generally) I am able to get the error code as a return value from the function using, return (PQresultErrorField(res,PG_DIAG_SQLSTATE)); Problem is i don't know how to generalize the messages once i get this....Pls any one help me in this regard Thanks, Sandhya ----- Original Message ----- From: "Michael Fuhr" To: "sandhya" Cc: "postgre" Sent: Wednesday, October 19, 2005 10:55 PM Subject: Re: [ADMIN] Reg : Error Handling > On Wed, Oct 19, 2005 at 03:56:57PM +0530, sandhya wrote: > > In error handling suppose if the database already exists.. > > > > It is returning : database "sample(say)" doesn't exists. > > What is "it"? What error handling are you talking about? What are > you doing that results in the error, and why does the error message > (database doesn't exist) contradict what you first said (database > already exists)? Or is that part of what's puzzling you? What > does your query or function code (or whatever) look like, and what > is the *exact* text of the error message? > > > If i want to return general error messages with out specifying names how can i? > > Return error messages from where? > > > Tell me where can i get the error codes for this instead of > > messages and how can i retrieve error no instead of printing message? > > Please tell us more about what you're doing and what problem you're > trying to solve. We don't have enough information to answer your > questions without a lot of guessing. > > Incidentally, I notice that your Subject headers always begin with > the word "Reg". What's that about? I've seen it a few other places > but have never known what it meant. Anybody? > > -- > Michael Fuhr > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend From mike@fuhr.org Thu Oct 20 06:18:39 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0CCB1DA724 for ; Thu, 20 Oct 2005 03:18:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99191-03 for ; Thu, 20 Oct 2005 06:18:36 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id D182ADA243 for ; Thu, 20 Oct 2005 03:18:36 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j9K6ISu4095287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 Oct 2005 00:18:32 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id j9K6ISJW073358; Thu, 20 Oct 2005 00:18:28 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id j9K6IQYH073357; Thu, 20 Oct 2005 00:18:26 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 20 Oct 2005 00:18:26 -0600 From: Michael Fuhr To: sandhya Cc: postgre Subject: Re: Reg : Error Handling Message-ID: <20051020061825.GA71430@winnie.fuhr.org> References: <057401c5d497$a25e81e0$cd00000a@amiindiahjwbgh> <20051019172507.GA72974@winnie.fuhr.org> <00b401c5d537$9503a9d0$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00b401c5d537$9503a9d0$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/227 X-Sequence-Number: 19299 On Thu, Oct 20, 2005 at 10:30:36AM +0530, sandhya wrote: > I am able to get the error code as a return value from the function using, > return (PQresultErrorField(res,PG_DIAG_SQLSTATE)); > Problem is i don't know how to generalize the messages once i get > this....Pls any one help me in this regard The "PostgreSQL Error Codes" appendix to the documentation explains what each SQLSTATE code means: http://www.postgresql.org/docs/8.0/interactive/errcodes-appendix.html See also server/utils/errcodes.h. I haven't found anywhere in the source code that provides mappings from SQLSTATE to generic messages, so you'll probably have to do that yourself. -- Michael Fuhr