[PATCH] allow pg_current_logfile() execution under pg_monitor role

From: Pavlo Golub <pavlo(dot)golub(at)cybertec(dot)at>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] allow pg_current_logfile() execution under pg_monitor role
Date: 2024-02-09 15:01:58
Message-ID: CAK7ymcLmEYWyQkiCZ64WC-HCzXAB0omM=Ypj9B3rXe8vUAFMqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

The patch attached fixes an oversight/inconsistency of disallowing the
pg_monitor system role to execute pg_current_logfile([text]).

pgwatch3=# create user joe;
CREATE ROLE
pgwatch3=# set role joe;
SET
pgwatch3=> select pg_current_logfile();
ERROR: permission denied for function pg_current_logfile
pgwatch3=> reset role;
RESET
pgwatch3=# grant pg_monitor to joe;
GRANT ROLE
pgwatch3=# set role joe;
SET
pgwatch3=> select pg_current_logfile();
ERROR: permission denied for function pg_current_logfile
pgwatch3=> select * FROM pg_ls_logdir();
name | size | modification
----------------------------------+----------+------------------------
postgresql-2024-02-08_130906.log | 652 | 2024-02-08 13:10:04+01
(5 rows)

Best regards,
Pavlo Golub

Attachment Content-Type Size
0001-allow-pg_current_logfile-execution-under-pg_monitor-.patch application/octet-stream 960 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-02-09 15:20:57 Re: Improve eviction algorithm in ReorderBuffer
Previous Message Alexander Lakhin 2024-02-09 15:00:01 Re: failure in 019_replslot_limit