From: Peter T Mount <peter@retep.org.uk>
To: Max Khon <fjoe@iclub.nsu.ru>
Cc: Peter Mount <peter@retep.org.uk>
Cc: David Wall <d.wall@computer.org>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: JDBC error codes to detect duplicates?
Date: Fri, 02 Mar 2001 09:26:32 -0500 (EST)
Message-ID: <983543192.3a9fad98b15e2@webmail.retep.org.uk> (raw)
In-Reply-To: <Pine.BSF.4.21.0103021529500.24706-100000@iclub.nsu.ru>
References: <Pine.BSF.4.21.0103021529500.24706-100000@iclub.nsu.ru>
Quoting Max Khon <fjoe@iclub.nsu.ru>:
> 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/
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: peter@retep.org.uk, fjoe@iclub.nsu.ru, d.wall@computer.org
Subject: Re: JDBC error codes to detect duplicates?
In-Reply-To: <983543192.3a9fad98b15e2@webmail.retep.org.uk>
* 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