Properties

Name: column_privileges 
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 
  column_name  sql_identifier  -1 
  privilege_type  character_data  -1 
  is_grantable  character_data  -1 
Total: 8 column(s)

SQL


CREATE VIEW column_privileges AS
    SELECT (u_grantor.rolname)::sql_identifier AS grantor, (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, (a.attname)::sql_identifier AS column_name, (pr."type")::character_data AS privilege_type, (CASE WHEN aclcontains(c.relacl, makeaclitem(grantee.oid, u_grantor.oid, pr."type", true)) THEN 'YES'::text ELSE 'NO'::text END)::character_data AS is_grantable FROM pg_attribute a, pg_class c, pg_namespace nc, pg_authid u_grantor, (SELECT pg_authid.oid, pg_authid.rolname FROM pg_authid UNION ALL SELECT (0)::oid AS oid, 'PUBLIC') grantee(oid, rolname), (((SELECT 'SELECT' UNION ALL SELECT 'INSERT') UNION ALL SELECT 'UPDATE') UNION ALL SELECT 'REFERENCES') pr("type") WHERE (((((((a.attrelid = c.oid) AND (c.relnamespace = nc.oid)) AND (a.attnum > 0)) AND (NOT a.attisdropped)) AND (c.relkind = ANY (ARRAY['r'::"char", 'v'::"char"]))) AND aclcontains(c.relacl, makeaclitem(grantee.oid, u_grantor.oid, pr."type", false))) AND ((pg_has_role(u_grantor.oid, 'USAGE'::text) OR pg_has_role(grantee.oid, 'USAGE'::text)) OR (grantee.rolname = 'PUBLIC'::name)));


ALTER TABLE information_schema.column_privileges OWNER TO postgres;

See Also

List of views