Properties

Name: role_table_grants 
Owner: postgres 
Has rules:  
Has Triggers:  
Comment:  

Columns

Name Type Length
  grantor  sql_identifier  -1 
  grantee  sql_identifier  -1 
  table_catalog  sql_identifier  -1 
  table_schema  sql_identifier  -1 
  table_name  sql_identifier  -1 
  privilege_type  character_data  -1 
  is_grantable  character_data  -1 
  with_hierarchy  character_data  -1 
Total: 8 column(s)

SQL


CREATE VIEW role_table_grants AS
    SELECT (u_grantor.rolname)::sql_identifier AS grantor, (g_grantee.rolname)::sql_identifier AS grantee, (current_database())::sql_identifier AS table_catalog, (nc.nspname)::sql_identifier AS table_schema, (c.relname)::sql_identifier AS table_name, (pr."type")::character_data AS privilege_type, (CASE WHEN aclcontains(c.relacl, makeaclitem(g_grantee.oid, u_grantor.oid, pr."type", true)) THEN 'YES'::text ELSE 'NO'::text END)::character_data AS is_grantable, ('NO'::character varying)::character_data AS with_hierarchy FROM pg_class c, pg_namespace nc, pg_authid u_grantor, pg_authid g_grantee, (((((SELECT 'SELECT' UNION ALL SELECT 'DELETE') UNION ALL SELECT 'INSERT') UNION ALL SELECT 'UPDATE') UNION ALL SELECT 'REFERENCES') UNION ALL SELECT 'TRIGGER') pr("type") WHERE ((((c.relnamespace = nc.oid) AND (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char"]))) AND aclcontains(c.relacl, makeaclitem(g_grantee.oid, u_grantor.oid, pr."type", false))) AND ((u_grantor.rolname IN (SELECT enabled_roles.role_name FROM enabled_roles)) OR (g_grantee.rolname IN (SELECT enabled_roles.role_name FROM enabled_roles))));


ALTER TABLE information_schema.role_table_grants OWNER TO postgres;

See Also

List of views