pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter T Mount <peter@retep.org.uk>
To: Cedar Cox <cedarc@visionforisrael.com>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: David Wall <d.wall@computer.org>
Cc: Max Khon <fjoe@iclub.nsu.ru>
Cc: Peter Mount <peter@retep.org.uk>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: JDBC error codes to detect duplicates?
Date: Fri, 02 Mar 2001 04:09:35 -0500 (EST)
Message-ID: <983524175.3a9f634f72a6a@webmail.retep.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.21.0103021043570.28455-100000@nanu.visionforisrael.com>
References: <Pine.LNX.4.21.0103021043570.28455-100000@nanu.visionforisrael.com>

Quoting Cedar Cox <cedarc@visionforisrael.com>:

> 
> As stated, the backend protocol doesn't pass error codes but error
> messages.  My question is, are there enough of these kind of things to
> create a new protocol version (7.2)?  After all, we are still using the
> same protocol since (?)6.5.  I think adding error codes would not only
> benefit JDBC but ODBC and possibly others also.  I know there have been
> various discussions like this one about parsing error messages in the
> ODBC
> driver.  As I remember, there were one or two other things that have
> been
> discussed that would require a change in the protocol also.  Just my
> two
> cents.

I totally agree. Putting the error codes (an extra 2 or 4 bytes) in the 
protocol shouldn't be too much hardship, and does mean several benefits:

1: No parsing of error messages on the client side
2: Small clients (embeded systems) can ignore the textual side of the message
3: It would be optional not to send the textual message - just the error 
number. Again good for non-human clients
4: Codes would be language independent (human that is). Currently AFAIK only 
JDBC supports it's own error messages in non-english languages. Having the 
codes would mean the backend ones could also be in non-english format and the 
clients would still work fine.

Virtually every interface would benefit from it.

Peter

> 
> -Cedar
> 
> On Thu, 1 Mar 2001, Bruce Momjian wrote:
> 
> > I have ideas on how to do error codes and multiple languages.  I can
> > make a proposal for 7.2.
> > 
> > [ Charset ISO-8859-1 unsupported, converting... ]
> > > > >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.
> > > 
> > > Practically speaking, how often do the messages really change
> between
> > > releases?  It seems that we could create a pluggable translator that
> would
> > > work based on the release version.  If the messages change too
> frequently,
> > > then something's seriously wrong with Postgresql server since the
> main
> > > sql-portion of the system has been in place and there aren't too
> many things
> > > a program really needs to detect about a database (missing row,
> duplicate
> > > key, constraint violation, transaction error, deadlock detected,
> etc.).
> > > 
> > > David
> > > 
> > > 
> > 
> > 
> > -- 
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> > 
> 
> 



-- 
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/



view thread (12+ messages)  latest in thread

Message-ID: <983524175.3a9f634f72a6a@webmail.retep.org.uk>
Permalink:  ../983524175.3a9f634f72a6a@webmail.retep.org.uk/
Also on:    postgresql.org/message-id/983524175.3a9f634f72a6a@webmail.retep.org.uk

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: peter@retep.org.uk, cedarc@visionforisrael.com, pgman@candle.pha.pa.us, d.wall@computer.org, fjoe@iclub.nsu.ru
  Subject: Re: JDBC error codes to detect duplicates?
  In-Reply-To: <983524175.3a9f634f72a6a@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