has_schema_privilege(), but taking inheritance into account

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: has_schema_privilege(), but taking inheritance into account
Date: 2025-10-02 12:21:51
Message-ID: CAFCRh--8r8ivUBZttLW3jKtsu++nJd3-mE37AJR5eY9gQfoVzg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

With pg_has_role(), I can use USAGE for access right now, or MEMBER
for "possible" access after a SET ROLE. I.e. I can see GRANT
INHERIT'ance in action.

But with has_schema_privilege(..., 'USAGE'), I can only check the
"right now" case. But I'd like to be able to take "indirect USAGE"
into account, via non-INHERIT'ed ROLE membership. To mirror what
pg_has_role() provides.

Could there be an extra argument to check for INHERIT and GRANTABLE?
Or variation in the string it accept to allow checking for those?

E.g. you can check for ADMIN OPTION (i.e. regrantable) with
pg_has_role(). But you can't with has_schema_privilege() (or other
ACL-based object classes).

Basically I'd wish for inheritance and grantable aware
has_xyz_privilege(), similar to pg_has_role().

Any chance this might land eventually?
Am I the only one who uses ROLEs that extensively and thus feels that need?

Baring the above, any way to similute it in SQL? --DD

Browse pgsql-general by date

  From Date Subject
Next Message Nathan Bossart 2025-10-02 17:37:44 Re: Clarification on Role Access Rights to Table Indexes
Previous Message Adrian Klaver 2025-10-01 15:23:30 Re: Downgrade pgsql 17 to pgsql 12 question