X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 74A2BD7BB3 for ; Sat, 5 Nov 2005 08:50:39 -0400 (AST) 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 07538-06 for ; Sat, 5 Nov 2005 12:50:34 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 38EFDD680C for ; Sat, 5 Nov 2005 08:50:35 -0400 (AST) Received: (qmail 14540 invoked by uid 1112); 5 Nov 2005 12:52:49 -0000 Date: Sat, 5 Nov 2005 07:52:49 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Jojo Paderes Cc: pgsql-jdbc@postgresql.org Subject: Re: Detailed Stored Proc Exception Message at JDBC Layer In-Reply-To: <65f9ddfb0511050355s343df7d4k1667bcd28826ef1e@mail.gmail.com> Message-ID: References: <65f9ddfb0511050355s343df7d4k1667bcd28826ef1e@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/27 X-Sequence-Number: 14125 On Sat, 5 Nov 2005, Jojo Paderes wrote: > I'm using PostgresSQL pl/pgSQL functions for executing data > inserts/updates and uses Java JDBC for to execute these functions on the > application layer. I'm having problems debugging my db functions due to > the limited exception message thrown at the Java application layer. I > would like to find a way wherein I can use the exception message on the > Java app to trace where exactly the error occurred in the database > function. We recently added some more detail to the default exception message, but unfortunately that does not cover the specific case you're interested in. We've got a lot of fields to choose from and don't want to overwhelm a user: http://www.postgresql.org/docs/8.0/static/protocol-error-fields.html To get the 'W' or "Where" information you need to increase the driver's loglevel via a URL parameter. Try adding "?loglevel=1" to your connection string. If your application is pg specific and you're using a recent driver version you may test if a thrown SQLException is in fact a PSQLException and then see if it has an available ServerErrorMessage object available which will have all of the fields mentioned above. For debugging functions you may also need the 'p' and 'q' fields (internal query/position) which require going up to a loglevel of 2. Unfortunately this spits out a whole bunch of other junk as the driver runs. It seems we should consider adding W, p, and q messages to the default error message or add a new URL parameter like verboseExceptions=true. Thoughts? Kris Jurka