diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 24447c0017..66efb58f2e 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -26150,8 +26150,8 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); for information about the underlying features. Use of functions for replication origin is only allowed to the - superuser by default, but may be allowed to other users by using the - GRANT command. + superuser and pg_read_all_stats roles by default, but may be allowed + to other users by using the GRANT command. Use of functions for replication slots is restricted to superusers and users having REPLICATION privilege. diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index eb560955cd..c626ad4aed 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -1256,6 +1256,9 @@ CREATE VIEW pg_replication_origin_status AS REVOKE ALL ON pg_replication_origin_status FROM public; +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; + -- All columns of pg_subscription except subconninfo are publicly readable. REVOKE ALL ON pg_subscription FROM public; GRANT SELECT (oid, subdbid, subname, subowner, subenabled, subbinary,