Thanks for taking a look, I attached the v3 version with the refinements.

> 01.
> ```
> +GRANT EXECUTE ON FUNCTION pg_show_replication_origin_status() TO 
> pg_read_all_stats;
> ```
> I cannot find existing examples to GRANT EXECUTION in the file. Per my quick
> lookup it's controled under the pg_proc.dat.

Looks like I was working on an older copy. Since commit f95d73ed433
("Simplify creation of built-in functions with non-default ACLs",
[1]), non-default ACLs for built-in functions are moved from
system_functions.sql/system_views.sql. v3 follows that now.

> 02.
> ```
> +SELECT 
> has_function_privilege('regress_readallstats','pg_show_replication_origin_status()','EXECUTE');
>  -- no
> ```
> Do we have to check the internal function? E.g., a view 
> pg_dsm_registry_allocations
> is a wrapper of pg_get_dsm_registry_allocations but the latter one is not 
> tested.

I dropped the has_function_privilege() checks. As with the other
pg_read_all_stats views, the SELECT COUNT(*) on the view run as a
member of pg_read_all_stats already exercises EXECUTE on the backing
function

[1] https://postgr.es/m/[email protected]

Thanks,
Virender

Attachment: v3-0001-Allow-pg_read_all_stats-to-read-replication-origi.patch
Description: Binary data

Reply via email to