pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: NielsG <NielsG@aquafold.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Minor Feature Request
Date: Tue, 5 Apr 2005 17:49:49 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0504051735580.2530@leary.csoft.net> (raw)
In-Reply-To: <42530F4C.6060502@aquafold.com>
References: <42530F4C.6060502@aquafold.com>



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



view thread (8+ messages)  latest in thread

Message-ID: <Pine.BSO.4.56.0504051735580.2530@leary.csoft.net>
Permalink:  ../Pine.BSO.4.56.0504051735580.2530@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.56.0504051735580.2530@leary.csoft.net

 · 

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: books@ejurka.com, NielsG@aquafold.com
  Subject: Re: Minor Feature Request
  In-Reply-To: <Pine.BSO.4.56.0504051735580.2530@leary.csoft.net>
  References: <42530F4C.6060502@aquafold.com> <Pine.BSO.4.56.0504051735580.2530@leary.csoft.net>

* 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