Re: Identifying a message in emit_log_hook.

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Identifying a message in emit_log_hook.
Дата
Msg-id CANP8+jLX3Z10T=dZtRBGUWRgCfZtLiPf0=QaNmFwciaFv=H1cA@mail.gmail.com
обсуждение исходный текст
Ответ на Identifying a message in emit_log_hook.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: Identifying a message in emit_log_hook.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
On 16 February 2016 at 09:47, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote:
 
I'm planning to change the error level of a specific error
message.  We can use emit_log_hook for this purpose but we have
no reliable means to identify what a message is.

For messages without valid sqlerrcode, filename:lineno could be
used to identify but lineno is too unstable.  One possible and
most straightforward way to solve this is defining identifiers
covering all error messages but such identifiers are too hard to
manage.  ErrorData.message could also be used but NLS translation
and placeholders prevent it from being identified by simple means
like strcmp(3).

As a solution for this problem, I'd like to porpose to have an
additional member in the struct ErrorData to hold a message id,
that is, the format string for errmsg(). This is not best but
useful enough.

It is somewhat a crude way, but the attached small patch would
do.

Is there any opinions or suggestions?

First, I support the concept of message ids and any work you do in moving this forwards.

If you were to require message ids, how would this work for extensions? Many things write to the log, so this solution would rely upon 100% compliance with your new approach. I think that is unlikely to happen.

I suggest an approach that allows optionally accessing a message id by hashing the English message text. That would allow people to identify messages without relying on people labelling everything correctly, as well as writing filters that do not depend upon language.

I'm guessing this would require making the pre-translated error text available to plugins as well as translated form.

--
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

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

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: extend pgbench expressions with functions
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: custom function for converting human readable sizes to bytes