Hi,
pg_log_backend_memory_contexts() should be designed not to send the messages about the
memory contexts to the client regardless of client_min_messages. But I found that the
message "logging memory contexts of PID %d" can be sent to the client because
it's ereport()'d with LOG level instead of LOG_SERVER_ONLY. Is this a bug, and shouldn't
we use LOG_SERVER_ONLY level to log that message? Patch attached.
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 2876f6868c..e12be1b9bd 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -1042,8 +1042,14 @@ ProcessLogMemoryContextInterrupt(void)
{
LogMemoryContextPending = false;
- ereport(LOG,
- (errmsg("logging memory contexts of PID %d",
MyProcPid)));
+ /*
+ * Use LOG_SERVER_ONLY to prevent this message from being sent to the
+ * connected client.
+ */
+ ereport(LOG_SERVER_ONLY,
+ (errhidestmt(true),
+ errhidecontext(true),
+ errmsg("logging memory contexts of PID %d",
MyProcPid)));
/*
* When a backend process is consuming huge memory, logging all its
memory