Hi, I have been looking at the requirement for providing non-superuser read access to specific catalog relations, specifically pg_replication_origin_status. During this, I reviewed the capabilities of the pg_read_all_stats role.
Looks like pg_read_all_stats was originally designed to grant access to all pg_stats_* views, a few other monitoring views defined in system_views.sql have been included over time. However, access to pg_replication_origin_status remains restricted and is not currently covered by existing roles such as pg_read_all_stats, pg_read_all_data, or pg_monitor. The attached patch grants pg_read_all_stats read access to the pg_replication_origin_status view and its underlying function, consistent with the existing approach for monitoring views in system_views.sql. I have also included the relevant regression tests. On pgsql-hackers, I noted a previous discussion [1] regarding granting this access; however, that discussion focused on the pg_monitor role rather than pg_read_all_stats and never got commited. [1] https://www.postgresql.org/message-id/flat/CAPdiE1zUeSycQ-VHrZQMDR4vkPthYTSxeQPXM-ZfH8QHDBCE%3DQ%40mail.gmail.com Thanks, Virender
0001-Grant-pg-read-all-stats-access-to-replication-origin.patch
Description: Binary data
