Re: JDBC error codes to detect duplicates?

From: Max Khon <fjoe(at)iclub(dot)nsu(dot)ru>
To: Peter Mount <peter(at)retep(dot)org(dot)uk>
Cc: David Wall <d(dot)wall(at)computer(dot)org>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: JDBC error codes to detect duplicates?
Date: 2001-03-02 09:34:34
Message-ID: Pine.BSF.4.21.0103021529500.24706-100000@iclub.nsu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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.

/fjoe

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Max Khon 2001-03-02 09:46:17 Re: JDBC error codes to detect duplicates?
Previous Message Raymond 2001-03-02 09:22:03 Large Object through ODBC