postgresql - view schema privileges

后端 未结 9 2015
再見小時候
再見小時候 2020-12-24 12:17

Is there a query I can run to show currently assigned privileges on a particular schema?

i.e. privileges that were assigned like so:

GRANT USAGE ON S         


        
9条回答
  •  梦谈多话
    2020-12-24 13:08

    This is what psql uses internally :)

    SELECT n.nspname AS "Name",
      pg_catalog.pg_get_userbyid(n.nspowner) AS "Owner",
      pg_catalog.array_to_string(n.nspacl, E'\n') AS "Access privileges",
      pg_catalog.obj_description(n.oid, 'pg_namespace') AS "Description"
    FROM pg_catalog.pg_namespace n
    WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'
    ORDER BY 1;
    

提交回复
热议问题