Re: Log prefix missing for subscriber log messages received from publisher
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: vignesh C <vignesh21@gmail.com>, Álvaro Herrera <alvherre@kurilemu.de>
Cc: Fujii Masao <masao.fujii@gmail.com>,
pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-17T14:34:32Z
Lists: pgsql-hackers
On 2025/07/17 17:05, vignesh C wrote: > On Thu, 17 Jul 2025 at 11:18, Álvaro Herrera <alvherre@kurilemu.de> wrote: >> >> Hi, >> >> Shouldn't we be using a notice receiver rather than a notice processor? > > I saw the following comment in code regarding PQsetNoticeProcessor > should be deprecated: > /* > * The default notice message receiver just gets the standard notice text > * and sends it to the notice processor. This two-level setup exists > * mostly for backwards compatibility; perhaps we should deprecate use of > * PQsetNoticeProcessor? > */ > > So I changed it to PQsetNoticeReceiver. +1 As a side note, I'd like to clarify in the source comments or documentation that PQsetNoticeProcessor() exists mainly for backward compatibility, and PQsetNoticeReceiver() should be preferred. But that's a separate topic from this patch. > The attached v5 version patch > has the changes for the same. Thanks for updating the patches! +static void notice_receiver(void *arg, const PGresult *result); For consistency with the typedef for PQnoticeReceiver, it would be better to name the argument "res" instead of "result". + * Set a custom notice receiver so that NOTICEs, WARNINGs, and similar The "s" in "NOTICEs" and "WARNINGs" isn't needed. + * Trim the trailing newline from the message text passed to the notice + * receiver, as it always includes one, to produce cleaner log output. "message text passed to the notice receiver" should be changed to "message text returned by PQresultErrorMessage()"? Regards, -- Fujii Masao NTT DATA Japan Corporation
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Remove translation marker from libpq-be-fe-helpers.h.
- a7ca73af662b 19 (unreleased) landed
-
Log remote NOTICE, WARNING, and similar messages using ereport().
- 112faf1378ee 19 (unreleased) landed
-
Remove translation markers from libpq-be-fe-helpers.h
- 213c959a294d 17.0 cited