pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: NielsG <NielsG@aquafold.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Minor Feature Request
Date: Tue, 05 Apr 2005 16:36:34 -0700
Message-ID: <42532102.9070006@aquafold.com> (raw)
In-Reply-To: <42531BD3.80801@opencloud.com>
References: <42530F4C.6060502@aquafold.com>
	<Pine.BSO.4.56.0504051735580.2530@leary.csoft.net>
	<425317D7.4020509@opencloud.com>
	<Pine.BSO.4.56.0504051759410.22871@leary.csoft.net>
	<42531BD3.80801@opencloud.com>

Hi,

There are two issues that I am trying to solve.  One is for my SQL Query 
tool which just executes a user defined statement and prints out the 
SQLException.getMessage() text.  This currently works well, although a 
Line number in the message for CREATE FUNCTION errors would be nice 
(Users have asked for this, so they can get the same helpfull message as 
PGAdmin).  The second issue is that I am building a Procedure/Function 
editor which displays the error message after a CREATE FUNCTION in a 
Grid, where the user can double click on the error message and my tool 
will automatically highlight the line which has the error.  All I really 
need is the line number, although if it gives me the character position 
I can easily calculate the line number.

It doesn't really matter to me how I get the line number, whether a 
"Line X" in the message or a PGException specific class.  The reason is 
because my tool has specific code for all databases that it supports.  
For example, the procedure editor that I am working on gets the line 
number for Oracle by quering the all_errors table, it gets the line 
number for SQL Server by parsing the getMessage() text which has the 
Line number at the beginning of the text, it gets the line number for 
Sybase Anywhere from the getMessage() text which is at the end of the 
text and for Sybase it gets it from a SybSQLException class specific 
with Sybase errors.

So, it doesn't really matter how the line number is presented to me, I 
already have code to parse it.  And it doesn't matter if it is 
PostgreSQL specific because I have alot of PG specific code already.

thanks
-Niels



Oliver Jowett wrote:

>Kris Jurka wrote:
>  
>
>>On Wed, 6 Apr 2005, Oliver Jowett wrote:
>>
>>
>>    
>>
>>>Perhaps we should put accessors for the various message parts on
>>>PSQLException, but leave the SQLException message as it currently is.
>>>
>>>      
>>>
>>This could work for a pg specific admin tool or client, but not a 
>>generic/portable java client.
>>    
>>
>
>Right, but aren't we talking about a client that knows about postgresql
>internals anyway? There's no concept of line numbers, hints, etc.
>associated with an exception in standard JDBC anyway, and as you said
>it's not obvious what is useful to have in the error message for
>standard clients.
>
>Niels was talking about putting the line number into the message, then
>parsing the message to get this info. That seems pretty horrible since
>then you have lots of extra work in the app, and the app is still
>postgresql-specific.. It seems much cleaner if it can just do something
>like:
>
>  try {
>    // ...
>  } catch (PSQLException e) {
>    if (e instanceof PSQLException)
>      linenumber = ((PSQLException)e).getLineNumber();
>    else
>      linenumber = -1;
>
>    // handle exception
>  }
>
>-O
>
>
>  
>

view thread (8+ messages)  latest in thread

Message-ID: <42532102.9070006@aquafold.com>
Permalink:  ../42532102.9070006@aquafold.com/
Also on:    postgresql.org/message-id/42532102.9070006@aquafold.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: NielsG@aquafold.com, oliver@opencloud.com, books@ejurka.com
  Subject: Re: Minor Feature Request
  In-Reply-To: <42532102.9070006@aquafold.com>
  References: <42530F4C.6060502@aquafold.com> <Pine.BSO.4.56.0504051735580.2530@leary.csoft.net> <425317D7.4020509@opencloud.com> <Pine.BSO.4.56.0504051759410.22871@leary.csoft.net> <42531BD3.80801@opencloud.com> <42532102.9070006@aquafold.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