Re: Assignment scheme for implementation-defined error codes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assignment scheme for implementation-defined error codes?
Date: 2003-07-28 14:02:09
Message-ID: 8973.1059400929@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> ... I'm wondering what kind of
> scheme we should use to allow clients to reserve some SQLSTATE codes for
> their own use.

> The errors I'm currently looking at can be thought of as "internal
> errors", so should I be using the class XX, or maybe XY as internal error
> on the client side, or maybe YE as internal error on the client side in
> ecpg (so YL could be libpq, YO the ODBC driver, etc.)?

It seems reasonable to reserve Yxxxx for client-side internal errors,
with as you suggest the second character used to identify a particular
client library.

Note also that there are several standard SQLSTATEs that appear to be
intended for client-side use, such as
ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION

> What about creating client-specific subclasses of existing classes?

Again we could go with reserving the Y prefix, although the namespace is
getting rather tight there --- if we use the next character to
distinguish different clients, there's only one character left for the
individual errors. Perhaps a dozen or so per client will be enough.

> Is the DB2 SQLSTATE reference, where some codes were apparently taken
> from, available somewhere? (A web search doesn't show anything useful.)

You need to google for the "DB2 Message Reference"; in recent editions
the SQLSTATE stuff is in Volume 2, Chapter 3. There are complete sets
of DB2 manuals available as PDFs at www.ibm.com. I don't have a record
of the exact URL I found it at, but I've been using a PDF of the message
reference manual for DB2 Version 8.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-28 14:07:59 Re: Regression test failure date.
Previous Message Alvaro Herrera 2003-07-28 13:56:21 Re: Doubt w.r.t vacuum