On 2025/07/17 17:05, vignesh C wrote:
On Thu, 17 Jul 2025 at 11:18, Álvaro Herrera <alvhe...@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



Reply via email to