From 83b38cb1f15fecc7b93fcf544ae53230e9627bb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mart=C3=ADn=20Marqu=C3=A9s?=
 <martin.marques@2ndquadrant.com>
Date: Wed, 3 Jun 2020 10:57:32 -0300
Subject: [PATCH v3 2/4] We want the monitoring role `pg_read_all_stats` to be
 able to SELECT from `pg_replication_origin_status`. We also need to give this
 role EXECUTE privileges for `pg_show_replication_origin_status()`.

This will help so output diagnostics and monitoring tools can be able to
gather replication origins status without requiring superuser privileges
---
 src/backend/catalog/system_views.sql | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 6658f0c2eb2..f290e3ca6ea 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -1497,3 +1497,6 @@ GRANT EXECUTE ON FUNCTION pg_ls_tmpdir(oid) TO pg_monitor;
 GRANT pg_read_all_settings TO pg_monitor;
 GRANT pg_read_all_stats TO pg_monitor;
 GRANT pg_stat_scan_tables TO pg_monitor;
+
+GRANT EXECUTE ON FUNCTION pg_show_replication_origin_status() TO pg_read_all_stats;
+GRANT SELECT ON pg_replication_origin_status TO pg_read_all_stats;
-- 
2.21.3

