Identifying a message in emit_log_hook.

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Identifying a message in emit_log_hook.
Date: 2016-02-16 09:47:55
Message-ID: 20160216.184755.59721141.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

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?

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
ErrorData_msgids_20160216.diff text/x-patch 2.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-02-16 09:57:33 Re: Identifying a message in emit_log_hook.
Previous Message Kyotaro HORIGUCHI 2016-02-16 09:25:27 Re: [PROPOSAL] VACUUM Progress Checker.