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)
--
regards, Andrei Lepikhov
From 6a577860c0a7eaadd43d931f737ff5f2a954b597 Mon Sep 17 00:00:00 2001
From: "Andrei V. Lepikhov" <lepi...@gmail.com>
Date: Tue, 22 Jul 2025 14:25:48 +0200
Subject: [PATCH v0] Fix Makefile in modules employing the
libpqsrv_notice_receiver function
---
contrib/dblink/Makefile | 1 +
contrib/postgres_fdw/Makefile | 1 +
2 files changed, 2 insertions(+)
diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index fde0b49ddbb..ea6396bc70c 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -6,6 +6,7 @@ OBJS = \
dblink.o
PG_CPPFLAGS = -I$(libpq_srcdir)
SHLIB_LINK_INTERNAL = $(libpq)
+SHLIB_LINK = $(filter -lintl, $(LIBS))
EXTENSION = dblink
DATA = dblink--1.2.sql dblink--1.1--1.2.sql dblink--1.0--1.1.sql
diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile
index adfbd2ef758..bba2551df51 100644
--- a/contrib/postgres_fdw/Makefile
+++ b/contrib/postgres_fdw/Makefile
@@ -12,6 +12,7 @@ PGFILEDESC = "postgres_fdw - foreign data wrapper for
PostgreSQL"
PG_CPPFLAGS = -I$(libpq_srcdir)
SHLIB_LINK_INTERNAL = $(libpq)
+SHLIB_LINK = $(filter -lintl, $(LIBS))
EXTENSION = postgres_fdw
DATA = postgres_fdw--1.0.sql postgres_fdw--1.0--1.1.sql
postgres_fdw--1.1--1.2.sql
--
2.50.1