Re: Log prefix missing for subscriber log messages received from publisher

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Log prefix missing for subscriber log messages received from publisher
Date: 2025-07-17 14:34:32
Message-ID: b7eb8488-2c75-445a-9480-09c630d09673@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025/07/17 17:05, vignesh C wrote:
> On Thu, 17 Jul 2025 at 11:18, Álvaro Herrera <alvherre(at)kurilemu(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2025-07-17 14:54:44 Re: Add progressive backoff to XactLockTableWait functions
Previous Message Bertrand Drouvot 2025-07-17 14:25:46 Re: Fix lwlock.c and wait_event_names.txt discrepancy