Re: SQLSTATEs for warnings

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: SQLSTATEs for warnings
Дата
Msg-id Pine.LNX.4.56.0308011408450.881@krusty.credativ.de
обсуждение исходный текст
Ответ на Re: SQLSTATEs for warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: SQLSTATEs for warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane writes:

> Peter Eisentraut <peter_e@gmx.net> writes:
> > In other words, an info, notice, or warning must have a class 00, 01, 02.
>
> I suspect though that the spec is assuming that the SQLSTATE code is the
> *only* way for the application to determine whether the message is
> success, warning, or error.  Since we have other signaling mechanisms
> (the severity field, or even more basically the Error/Notice message
> type distinction), I'm not convinced we need to be entirely anal about
> this division.

The severity field is useless, because it contains localized text that
cannot be evaluated by a program.  Also, neither the severity field nor
the error/notice message distinction is necessarily available in
interfaces that work at a layer above libpq (e.g., embedded SQL).

There is no portable (let alone consistent) way right now to detect
whether a given condition is success, a warning, or an error.

> AFAICS the alternative to misusing error-class SQLSTATEs as warnings is
> that we invent implementation-specific warning codes.

I don't see that as being allowed.

> Is it really worth having two codes for what amounts to the same
> condition?

The same condition shouldn't be a warning in one place and an error in
another.  Otherwise it's not really the same condition.

-- 
Peter Eisentraut   peter_e@gmx.net


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: ECPG: 7.4 and a "to" Variable
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Another nasty pg_dump problem