Re: pgsql: Log remote NOTICE, WARNING, and similar messages using ereport()

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: Fujii Masao <fujii(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Log remote NOTICE, WARNING, and similar messages using ereport()
Date: 2025-07-22 12:52:12
Message-ID: CAHGQGwGozkwVzUFSAKMk2BsX6qNCoP7O43FoFOr376FFSnOWXA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Jul 22, 2025 at 9:30 PM Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:
>
> On 22/7/2025 07:22, Fujii Masao wrote:
> > Log remote NOTICE, WARNING, and similar messages using ereport().
> >
> > Previously, NOTICE, WARNING, and similar messages received from remote
> > servers over replication, postgres_fdw, or dblink connections were printed
> > directly to stderr on the local server (e.g., the subscriber). As a result,
> > these messages lacked log prefixes (e.g., timestamp), making them harder
> > to trace and correlate with other log entries.
> >
> > This commit addresses the issue by introducing a custom notice receiver
> > for replication, postgres_fdw, and dblink connections. These messages
> > are now logged via ereport(), ensuring they appear in the logs with proper
> > formatting and context, which improves clarity and aids in debugging.
> Perhaps I'm wrong, but it seems to me that you also need to add the
> libintl link to the Makefile of each module that uses the
> libpqsrv_notice_receiver routine.
> At least, without this patch, I can't build master under MacOS:
>
> Undefined symbols for architecture x86_64:
> "_libintl_gettext", referenced from:
> _libpqsrv_notice_receiver in dblink.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)

This issue is currently being discussed in thread [1]. The consensus there is
to remove the translation-related changes (like the translation marker)
introduced by the original commit to resolve the problem.

Regards,

[1] https://postgr.es/m/0e6299d9-608a-4ffa-aeb1-40cb8a99000b@oss.nttdata.com

--
Fujii Masao

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-07-22 13:04:02 pgsql: aio: Fix assertion, clarify README
Previous Message Álvaro Herrera 2025-07-22 12:51:46 Re: pgsql: Log remote NOTICE, WARNING, and similar messages using ereport()

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2025-07-22 12:56:23 Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)
Previous Message Álvaro Herrera 2025-07-22 12:51:46 Re: pgsql: Log remote NOTICE, WARNING, and similar messages using ereport()