Skip to content

Commit 6668a54

Browse files
Default monitoring roles - errata
25fff40 introduced default monitoring roles. Apply these corrections: * Allow access to pg_stat_get_wal_senders() by role pg_read_all_stats * Correct comment in pg_stat_get_wal_receiver() to show it is no longer superuser-only. Author: Feike Steenbergen Reviewed-by: Michael Paquier Apply to HEAD, then later backpatch to 10
1 parent ccf312a commit 6668a54

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/backend/replication/walreceiver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,8 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
14421442
if (!is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS))
14431443
{
14441444
/*
1445-
* Only superusers can see details. Other users only get the pid value
1445+
* Only superusers and members of pg_read_all_stats can see details.
1446+
* Other users only get the pid value
14461447
* to know whether it is a WAL receiver, but no details.
14471448
*/
14481449
MemSet(&nulls[1], true, sizeof(bool) * (tupdesc->natts - 1));

src/backend/replication/walsender.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include "access/xlog_internal.h"
5757
#include "access/xlogutils.h"
5858

59+
#include "catalog/pg_authid.h"
5960
#include "catalog/pg_type.h"
6061
#include "commands/dbcommands.h"
6162
#include "commands/defrem.h"
@@ -3242,11 +3243,12 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
32423243
memset(nulls, 0, sizeof(nulls));
32433244
values[0] = Int32GetDatum(pid);
32443245

3245-
if (!superuser())
3246+
if (!is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS))
32463247
{
32473248
/*
3248-
* Only superusers can see details. Other users only get the pid
3249-
* value to know it's a walsender, but no details.
3249+
* Only superusers and members of pg_read_all_stats can see details.
3250+
* Other users only get the pid value to know it's a walsender,
3251+
* but no details.
32503252
*/
32513253
MemSet(&nulls[1], true, PG_STAT_GET_WAL_SENDERS_COLS - 1);
32523254
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy