Re: Minor Feature Request - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Minor Feature Request
Date
Msg-id Pine.BSO.4.56.0504051735580.2530@leary.csoft.net
Whole thread Raw
In response to Minor Feature Request  (NielsG <NielsG@aquafold.com>)
Responses Re: Minor Feature Request
List pgsql-jdbc

On Tue, 5 Apr 2005, NielsG wrote:

> I am trying to figure out if I can get the line number, when executing a
> "CREATE FUNCTION" statement which fails.  The line number of where the
> error occurs.
>
> I would like to get back the line number 4, which is the line in where
> the syntax error occurs.  Could this be placed in the
> SQLException.getMessage() text? If so, then I can parse out the line
> number for my use. Otherwise, I can't find the line number anywhere.
>
> Example: [ERROR: Line 4: syntax error at or near "ELSE"]
>

There are many parts to a backend error message, see

http://www.postgresql.org/docs/8.0/static/protocol-error-fields.html

Putting all of these in the SQLException.getMessage() result would be
overload.  The driver currently only puts in severity and message by
default, but will include more info based on the driver's loglevel.  Is
position alone enough info to include?  It really kind of depends on what
you are executing what info you want back.  Position isn't relevent for
something like a duplicate key error.  Also what if a function syntax
error isn't picked up until runtime?  You'd also want "where".  I can see
people also wanting detail and hint for certain messages.  I see where
you're coming from, but I'm unsure what should really go into an error
message.

Kris Jurka

pgsql-jdbc by date:

Previous
From: NielsG
Date:
Subject: Minor Feature Request
Next
From: Oliver Jowett
Date:
Subject: Re: Minor Feature Request