X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6ADD052A55 for ; Wed, 6 Apr 2005 00:30:37 +0100 (BST) 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 21635-02 for ; Tue, 5 Apr 2005 23:30:35 +0000 (GMT) Received: from aquafold.com (s50.n3.vds2000.com [66.84.3.50]) by svr1.postgresql.org (Postfix) with ESMTP id 4FE785295C for ; Wed, 6 Apr 2005 00:30:34 +0100 (BST) Received: from [192.168.1.100] (119.95.218.209.transedge.com [209.218.95.119]) by aquafold.com (8.11.6/8.11.6) with ESMTP id j35NUFR08794; Tue, 5 Apr 2005 19:30:15 -0400 Message-ID: <42532102.9070006@aquafold.com> Date: Tue, 05 Apr 2005 16:36:34 -0700 From: NielsG User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oliver Jowett Cc: Kris Jurka , pgsql-jdbc@postgresql.org Subject: Re: Minor Feature Request References: <42530F4C.6060502@aquafold.com> <425317D7.4020509@opencloud.com> <42531BD3.80801@opencloud.com> In-Reply-To: <42531BD3.80801@opencloud.com> Content-Type: multipart/alternative; boundary="------------070008050505060101000802" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.198 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_10_20, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200504/36 X-Sequence-Number: 12643 This is a multi-part message in MIME format. --------------070008050505060101000802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > > > > --------------070008050505060101000802 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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


  

--------------070008050505060101000802--