Re: Clarification on Role Access Rights to Table Indexes

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Clarification on Role Access Rights to Table Indexes
Date: 2025-02-17 19:58:49
Message-ID: ba8f5e0596fbe18cf901d74de5879bc8ca85b436.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, 2025-02-17 at 23:31 +0530, Ayush Vatsa wrote:
> postgres=> SELECT pg_prewarm('pg_class_oid_index');
> ERROR:  permission denied for index pg_class_oid_index
> postgres=> RESET ROLE;
> RESET
>
> postgres=# GRANT SELECT ON pg_class_oid_index TO alpha;
> ERROR:  "pg_class_oid_index" is an index
> Based on this, I have few questions:
> 1. Can a role have access rights to a table without having access to its index?
> 2. If yes, how can we explicitly grant access to the index?
> 3. If no, and the role inherently gets access to the index when granted access to the table, why
> does the pg_prewarm call fail [1] in the above scenario?

I have seen a complaint about this bug before:
https://dba.stackexchange.com/a/344603/176905

Yours,
Laurenz Albe

--

*E-Mail Disclaimer*
Der Inhalt dieser E-Mail ist ausschliesslich fuer den
bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat
dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte,
dass jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder
Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir bitten Sie, sich
in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

*CONFIDENTIALITY NOTICE & DISCLAIMER
*This message and any attachment are
confidential and may be privileged or otherwise protected from disclosure
and solely for the use of the person(s) or entity to whom it is intended.
If you have received this message in error and are not the intended
recipient, please notify the sender immediately and delete this message and
any attachment from your system. If you are not the intended recipient, be
advised that any use of this message is prohibited and may be unlawful, and
you must not copy this message or attachment or disclose the contents to
any other person.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2025-02-17 20:32:47 Loading the latest N rows into the cache seems way too fast.
Previous Message Tom Lane 2025-02-17 19:57:43 Re: Clarification on Role Access Rights to Table Indexes

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-02-17 20:03:30 Re: UUID v7
Previous Message Tom Lane 2025-02-17 19:57:43 Re: Clarification on Role Access Rights to Table Indexes