The documentation says:
Any particular role will have the sum of privileges granted directly to it, privileges granted to any role it is presently a member of, and privileges granted to PUBLIC.
How to get to know from psql CLI which privileges are granted to PUBLIC?
\du
seems to list all roles but it lacks a row for PUBLIC. I would expect it to be very easy and intuitive to find out which permissions a newly created role gets by default.
-
3Does this answer your question? How do I see where postgres privileges are coming from for a role?mustaccio– mustaccio2021年11月15日 23:53:28 +00:00Commented Nov 15, 2021 at 23:53
1 Answer 1
There is no easy way to get all privileges granted to PUBLIC
(or any other role, for that matter). You would have to scan the ACLs of all objects.
-
I was a bit confused about the privileges terminology. The documentation (at postgresql.org/docs/14/role-attributes.html) says: "A database role can have a number of attributes that define its privileges". These are the privileges I meant in my question - the ones associated with the role. Like whether it has a login privilege or not. But now I get it - PUBLIC itself does not have any attributes but DB objects like tables can have roles and groups, including PUBLIC, to do something with them like select or insert.alvarez– alvarez2021年11月16日 08:46:53 +00:00Commented Nov 16, 2021 at 8:46