Re: [proposal] Add an option for returning SQLSTATE in psql error message

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: [proposal] Add an option for returning SQLSTATE in psql error message
Дата
Msg-id CAFj8pRCTOTpNfk7hQnyjOPCz0=dTBkKaOT=7TGuUaQnDk7ag8g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [proposal] Add an option for returning SQLSTATE in psql error message  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [proposal] Add an option for returning SQLSTATE in psql error message  (didier <did447@gmail.com>)
Список pgsql-hackers


ne 2. 12. 2018 v 16:56 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
didier <did447@gmail.com> writes:
> Currently on error psql is printing Postgres' PQerrorMessage text, but
> there's no guarantee these messages are constant between Postgres
> versions and it's a pain when using psql for writing regression tests,

I don't buy that argument.  We use psql's normal display in all the
regular regression tests, and it's not a big maintenance problem.
If the error message changes, that's usually interesting in itself.

our tests are not against different PostgreSQL releases. When you have a code, that should to support more PostgreSQL releases, then it is sometimes difficult.


Also, if it does change, it's often because you're hitting a different
error-detection test, which more than likely is throwing a different
SQLSTATE anyway.

Lastly, because the SQL spec has been rather miserly in assigning
SQLSTATEs in some areas, there are lots of cases where the same
SQLSTATE is used for several distinct errors; for instance
ERRCODE_UNDEFINED_OBJECT covers a lot of ground.  Do you really
want your test cases to be unable to distinguish those?

There might be a use-case for showing only SQLSTATE, but writing
regression tests doesn't seem like a good example.

                        regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [proposal] Add an option for returning SQLSTATE in psql error message
Следующее
От: Tom Lane
Дата:
Сообщение: Re: AllocSetContextCreate changes breake extensions