Hi,
This is another issue with “[112faf137] Log remote NOTICE, WARNING, and similar
messages using ereport()”. From the commit message, the intention of the
feature is to log remote messages with ereport() to get better formatting:
```
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.
```
So remote messages should only be output to the server log, but currently they
can leak to the client if client_min_messages is set to log.
This is a simple repro:
```
evantest=# set client_min_messages=log;
SET
evantest=# select * from dblink('host=localhost dbname=postgres’,
'do $$ begin raise warning ''hello, client!!!''; end $$; select 1’)
as t(x int);
LOG: received message via remote connection: WARNING: hello, client!!!
x
---
1
(1 row)
```
The one-line fix is straightforward, just change the ereport() level from LOG
to LOG_SERVER_ONLY. I also added a test in the patch.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
v1-0001-Avoid-sending-remote-libpq-notices-back-to-client.patch
Description: Binary data
