Re: Allow pg_read_all_stats to read replication origin status

From: Virender Singla <virender(dot)cse(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Shubhra Jain <shubhra(dot)jain(at)ksolves(dot)com>, Dilip Kumar <DilipBalaut(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow pg_read_all_stats to read replication origin status
Date: 2026-11-20 15:40:29
Message-ID: CAM6Zo8zBzxAk0eQ4h9PBrYmwHrDw5UzC7w9L9FfKJeULgPC_Tw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net

Thanks,
Virender

Attachment Content-Type Size
v3-0001-Allow-pg_read_all_stats-to-read-replication-origi.patch application/octet-stream 5.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-11-20 15:43:36 Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000
Previous Message yuansong 2026-11-20 15:37:56 [PATCH v1] Fix stale composite type OIDs in cached PL/pgSQL expressions