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 19E1253829 for ; Tue, 5 Apr 2005 23:49:57 +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 10870-06 for ; Tue, 5 Apr 2005 22:49:48 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 243AB52965 for ; Tue, 5 Apr 2005 23:49:47 +0100 (BST) Received: (qmail 1344 invoked by uid 1112); 5 Apr 2005 22:49:49 -0000 Date: Tue, 5 Apr 2005 17:49:49 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: NielsG Cc: pgsql-jdbc@postgresql.org Subject: Re: Minor Feature Request In-Reply-To: <42530F4C.6060502@aquafold.com> Message-ID: References: <42530F4C.6060502@aquafold.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/31 X-Sequence-Number: 12638 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