pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Schlansker <stevenschlansker@gmail.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Extracting more useful information from PSQLException
Date: Sun, 3 Feb 2013 21:40:38 -0800
Message-ID: <CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com> (raw)
In-Reply-To: <alpine.BSO.2.00.1301311951020.23428@leary.csoft.net>
References: <EA739659-106D-4601-9D14-17BFFE67D3FF@gmail.com>
	<alpine.BSO.2.00.1212282053460.18287@leary.csoft.net>
	<alpine.BSO.2.00.1301311951020.23428@leary.csoft.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>


On Jan 31, 2013, at 4:55 PM, Kris Jurka <books@ejurka.com> wrote:

> 
> 
> On Fri, 28 Dec 2012, Kris Jurka wrote:
> 
>> On Fri, 28 Dec 2012, Steven Schlansker wrote:
>> 
>>> Is it possible / would it be a good addition to expose structured SQL 
>>> error information through JDBC?  If such a thing does not exist, is this 
>>> a feasible contribution?  I expect it might require some hacking on the 
>>> PostgreSQL server side to expose the error information in a structured 
>>> manner.  Or am I just dreaming too much, and this is not feasible?
>>> 
>> 
>> There is currently a patch in progress and under discussion for the server 
>> changes to expose this information.
> 
> This patch was committed to the server and I've exposed these field in the 
> JDBC driver through the somewhat ugly...
> 
> } catch (SQLException sqle) {
> 	ServerErrorMessage err = 
> ((PSQLException)sqle).getServerErrorMessage();
> 	System.out.println(err.getTable());
> }
> 
> The server infrastructure doesn't cover all the error cases I would have 
> hoped, so you can't just through data at the database and always be able 
> to produce an intelligent error response to a user, but it's a start.
> 
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=991f3e5ab3f8196d18d5b313c81a5f744f3baa...
> 
> https://github.com/pgjdbc/pgjdbc/commit/e9ac5f8d964202ab5d43e401d74dcd76cefd112e
> 

Fantastic!  Thanks so much.  I'll use this in the next revision of our database code :-)



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (4+ messages)

Message-ID: <CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com>
Permalink:  ../CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com/
Also on:    postgresql.org/message-id/CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: stevenschlansker@gmail.com, books@ejurka.com
  Subject: Re: Extracting more useful information from PSQLException
  In-Reply-To: <CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com>
  References: <EA739659-106D-4601-9D14-17BFFE67D3FF@gmail.com> <alpine.BSO.2.00.1212282053460.18287@leary.csoft.net> <alpine.BSO.2.00.1301311951020.23428@leary.csoft.net> <CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox