Re: pg_log_backend_memory_contexts() and log level

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_log_backend_memory_contexts() and log level
Date: 2022-01-27 03:45:10
Message-ID: 04596d19-1bb6-4865-391d-4e63c9b3317f@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/01/26 14:27, Bharath Rupireddy wrote:
> On Wed, Jan 26, 2022 at 10:46 AM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>>
>> On Wed, Jan 26, 2022 at 9:48 AM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>>>
>>> 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.
>>
>> +1. The patch LGTM.

Thanks for the review!

> 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;

Or it's enough to set role and execute the function? Either those or has_function_privilege() can be removed from the test, but I don't have strong reason to do that for now...

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2022-01-27 03:45:33 Re: pg_log_backend_memory_contexts() and log level
Previous Message Kyotaro Horiguchi 2022-01-27 02:55:47 Re: snapper and skink and fairywren (oh my!)