Dear Peter,
>> (1) Would you agree that it is a "bug"? That is, if the grantee is
>> PUBLIC, it is an enabled role for the current user, so it should appear
>> in the role_table_grants view...
>
> The whole point of role_table_grants is that it shows everything that
> table_privileges shows except privileges granted to public. So the
> behavior you observe is correct.
This is not my understanding of ISO/IEC 9075-11:2003(E), page 57 :
"5.39 ROLE_TABLE_GRANTS view
Function
Identifies the privileges on tables defined in this catalog that are
available or granted by the currently applicable roles."
From the definition above, ISTM that a privilege granted to PUBLIC should
also appear, both because it is granted by me and available to me.
Moreover, if I execute the SELECT of the view definition provided in the
standard (a little bit simplified, and executed on the information schema
instead of the "definition schema"), the PUBLIC stuff is displayed :
psql> SELECT grantor, grantee, table_name FROM information_schema.table_privileges WHERE grantee IN
(SELECTrole_name FROM information_schema.enabled_roles) OR grantor IN (SELECT role_name FROM
information_schema.enabled_roles);
... fabien | calvin | foo fabien | PUBLIC | foo
I think that the view definition in postgresql could simply reuse the view
defined in the standard.
--
Fabien.