Re: sqlstate 22P06 is a warning in an error's clothing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Abhijit Menon-Sen <ams(at)oryx(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sqlstate 22P06 is a warning in an error's clothing
Date: 2007-11-10 17:01:50
Message-ID: 16455.1194714110@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Abhijit Menon-Sen <ams(at)oryx(dot)com> writes:
> The server logs "WARNING: nonstandard use of \\ in a string literal at
> character 44", but the message comes with sqlstate code 22P06, which is
> in an error class ("Data exception"). So my application thinks it's an
> error, and is unhappy.

If you are trying to tell errors from warnings, why are you not looking
first at PQresultStatus (or equivalent in other client APIs)?

I think reassigning the message to another sqlstate will break more
clients than it fixes. It's not the only problematic case either, eg

ereport(NOTICE,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("identifier \"%s\" will be truncated to \"%.*s\"",
ident, len, ident)));

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michele Petrazzo - Unipex srl 2007-11-10 17:37:51 Re: functions are returns columns
Previous Message Gokulakannan Somasundaram 2007-11-10 16:58:38 Re: Free Space Map thoughts