set role issue
Hi,
I do the following command when connecting locally with user postgres
SET ROLE asuperrole; -- asuperrole has superuser privilege
GRANT SELECT ON pg_statistic TO test_role;
SELECT
grantee,
grantor,
table_catalog,
table_schema,
table_name,
privilege_type
FROM
information_schema.role_table_grants
WHERE
table_name = 'pg_statistic'
test_role| postgres | db012d00 | pg_catalog | pg_statistic |
SELECT
why the grantee is postgres?
Thanks in advance for clarification
Regards,
Fabrice
Fabrice Chapuis <fabrice636861@gmail.com> writes:
I do the following command when connecting locally with user postgres
SET ROLE asuperrole; -- asuperrole has superuser privilege
GRANT SELECT ON pg_statistic TO test_role;
why the grantee is postgres?
You mean "grantor", no? When a superuser does grant/revoke on some
object, it's recorded as though the object owner issued the command.
And postgres is the owner of the pg_statistic table.
regards, tom lane
Thank you for clarifying this point.
And yes of course grantor, sorry for the confusion.
Regards,
Fabrice
On Mon, Aug 4, 2025 at 4:30 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Show quoted text
Fabrice Chapuis <fabrice636861@gmail.com> writes:
I do the following command when connecting locally with user postgres
SET ROLE asuperrole; -- asuperrole has superuser privilege
GRANT SELECT ON pg_statistic TO test_role;why the grantee is postgres?
You mean "grantor", no? When a superuser does grant/revoke on some
object, it's recorded as though the object owner issued the command.
And postgres is the owner of the pg_statistic table.regards, tom lane