Re: Read access for pg_monitor to pg_replication_origin_status view
От | Martín Marqués |
---|---|
Тема | Re: Read access for pg_monitor to pg_replication_origin_status view |
Дата | |
Msg-id | CAPdiE1wK5gKGGUSebcGRHJjBBXmYVc797isGpzKRKFR9C0fQOA@mail.gmail.com обсуждение исходный текст |
Ответ на | Read access for pg_monitor to pg_replication_origin_status view (Martín Marqués <martin@2ndquadrant.com>) |
Ответы |
Re: Read access for pg_monitor to pg_replication_origin_status view
|
Список | pgsql-hackers |
Hi, > While working on some monitoring tasks I realised that the pg_monitor > role doesn't have access to the pg_replication_origin_status. > > Are there any strong thoughts on not giving pg_monitor access to this > view, or is it just something that nobody asked for yet? I can't find > any reason for pg_monitor not to have access to it. Further looking into this, I can see that the requirement of a superuser to access/monify the replication origins is hardcoded in backend/replication/logical/origin.c, so it's not a question of GRANTing access to the pg_monitor user. ``` static void replorigin_check_prerequisites(bool check_slots, bool recoveryOK) { if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("only superusers can query or manipulate replication origins"))); if (check_slots && max_replication_slots == 0) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("cannot query or manipulate replication origin when max_replication_slots = 0"))); if (!recoveryOK && RecoveryInProgress()) ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION), errmsg("cannot manipulate replication origins during recovery"))); } ``` I believe we could skip the superuser() check for cases like pg_replication_origin_session_progress() and pg_replication_origin_progress(). Once option could be to add a third bool argument check_superuser to replorigin_check_prerequisites() and have it set to false for the functions which a none superuser could execute. Patch attached -- Martín Marqués http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: