Re: pg_log_backend_memory_contexts() and log level - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: pg_log_backend_memory_contexts() and log level
Date
Msg-id CALj2ACVnFc2kV=DMoK7=3V6UzYmSUtj8oCnkxgfSjsAcX4EFbQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_log_backend_memory_contexts() and log level  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: pg_log_backend_memory_contexts() and log level
List pgsql-hackers
On Wed, Jan 26, 2022 at 10:46 AM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Wed, Jan 26, 2022 at 9:48 AM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
> >
> > Hi,
> >
> > pg_log_backend_memory_contexts() should be designed not to send the messages about the memory contexts to the
clientregardless of client_min_messages. But I found that the message "logging memory contexts of PID %d" can be sent
tothe 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_ONLYlevel to log that message? Patch attached. 
>
> +1. The patch LGTM.

While we are here, I think it's enough to have the
has_function_privilege, not needed to set role regress_log_memory and
then execute the function as we already have code covering the
function above (SELECT
pg_log_backend_memory_contexts(pg_backend_pid());). Thought?

SELECT has_function_privilege('regress_log_memory',
  'pg_log_backend_memory_contexts(integer)', 'EXECUTE'); -- yes

SET ROLE regress_log_memory;
SELECT pg_log_backend_memory_contexts(pg_backend_pid());
RESET ROLE;

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: pg_log_backend_memory_contexts() and log level
Next
From: torikoshia
Date:
Subject: Re: pg_log_backend_memory_contexts() and log level