postgres=# CREATE ROLE alpha;
CREATE ROLE
postgres=# GRANT SELECT ON pg_class TO alpha;
This is pointless, everyone (i.e. the PUBLIC pseudo-role) can already read pg_class.
1. Can a role have access rights to a table without having access to its index?
Roles don’t directly interact with indexes in PostgreSQL so this doesn’t even make sense. But if you need a yes/no answer, then yes.
3. If no, and the role inherently gets access to the index when granted access to the table, why
does thepg_prewarm
call fail [1] in the above scenario?
[1] https://github.com/postgres/postgres/blob/master/contrib /pg_prewarm/pg_prewarm.c#L108- L110
It fails because AFAICS there is no way for it to work on an index, only tables.
David J.