Received: from mail.retep.org.uk ([216.126.85.184]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f22ERpx19146 for ; Fri, 2 Mar 2001 09:27:51 -0500 (EST) (envelope-from peter@retep.org.uk) Received: (from nobody@localhost) by mail.retep.org.uk (8.11.1/8.11.1) id f22EQWO18894; Fri, 2 Mar 2001 09:26:32 -0500 (EST) (envelope-from peter@retep.org.uk) X-Authentication-Warning: mail.retep.org.uk: nobody set sender to peter@retep.org.uk using -f To: Max Khon Subject: Re: JDBC error codes to detect duplicates? Message-ID: <983543192.3a9fad98b15e2@webmail.retep.org.uk> Date: Fri, 02 Mar 2001 09:26:32 -0500 (EST) From: Peter T Mount Cc: Peter Mount , David Wall , pgsql-interfaces@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.3 X-Archive-Number: 200103/25 X-Sequence-Number: 1186 Quoting Max Khon : > hi, there! > > On Thu, 1 Mar 2001, Peter Mount wrote: > > > > > It seems that when an INSERT causes a duplicate key exception for > > > > unique/primary keys, the JDBC library is throwing the SQL > exception but > > > > there is no code that lets my program detect a duplicate key > error, or > > > which > > > > key caused the duplicate error. > > > > > > > > Is there a plan for the JDBC to return the codes for postgres back > to the > > > > program? I running 7.1beta4 now. > > > > > >AFAIK clean implementation of such feature is not possible because > backend > > >protocol does not have error codes (only error messages) > > > > Thats correct. It's also not practical to get the driver to translate > > > because the format of the messages can change between releases as > well. > > can we consider adding error code prepended to error message and > separated with e.g. one single space? seems that this will not break > anything but will allow JDBC/ODBC drivers to return meaningful error > codes. That is the other alternative, and one that could be implemented pretty quickly. Peter -- Peter Mount peter@retep.org.uk PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/ RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/