From: | Steven Schlansker <stevenschlansker(at)gmail(dot)com> |
---|---|
To: | Kris Jurka <books(at)ejurka(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Extracting more useful information from PSQLException |
Date: | 2013-02-04 05:40:38 |
Message-ID: | CC734F45-CA78-4F8B-8E34-A64D79D958E5@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Jan 31, 2013, at 4:55 PM, Kris Jurka <books(at)ejurka(dot)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=991f3e5ab3f8196d18d5b313c81a5f744f3baaea
>
> https://github.com/pgjdbc/pgjdbc/commit/e9ac5f8d964202ab5d43e401d74dcd76cefd112e
>
Fantastic! Thanks so much. I'll use this in the next revision of our database code :-)
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2013-02-04 10:40:52 | Re: setTimestamp(int, Timestamp, Calendar) ignoring time zone? |
Previous Message | Ian Pilcher | 2013-02-04 04:27:25 | setTimestamp(int, Timestamp, Calendar) ignoring time zone? |