Re: Change error code for hstore syntax error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Change error code for hstore syntax error
Дата
Msg-id 32686.1457725746@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Change error code for hstore syntax error  (Sherrylyn Branchaw <sbranchaw@gmail.com>)
Ответы Re: Change error code for hstore syntax error
Список pgsql-hackers
Sherrylyn Branchaw <sbranchaw@gmail.com> writes:
> The hstore module uses elog() to default to ERRCODE_INTERNAL_ERROR
> (SQLSTATE XX000) when the error message reads "Syntax error near '%c' at
> position %d".

Yeah, that is entirely bogus.  No user-facing error report should ever
return ERRCODE_INTERNAL_ERROR.

> I propose to switch to ereport() to return ERRCODE_SYNTAX_ERROR (SQLSTATE
> 42601), on the grounds that it's more transparent.

Hm, class 42 is generally meant for SQL-level syntax errors.  Are these
errors not coming from subroutines of hstore_in()?  I think our usual
convention is to use ERRCODE_INVALID_TEXT_REPRESENTATION for complaints
that a data value does not meet its type's conventions.  In any case
it seems closer to class 22 than 42.

While you're at it, please make the error message texts conform to
our style guidelines:
http://www.postgresql.org/docs/devel/static/error-style-guide.html

These seem to have multiple problems, starting with incorrect
capitalization and extending to failure to quote the whole string
being complained of.

In short, though, +1 for improving this stuff.
        regards, tom lane



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

Предыдущее
От: Sherrylyn Branchaw
Дата:
Сообщение: Change error code for hstore syntax error
Следующее
От: Salvador Fandiño
Дата:
Сообщение: Saving SRF context