PostgreSQL: デフォルトの権限を確認するSQL
3251 ワード
PostgreSQLでデフォルトの権限設定がどうなっているか確認するSQLです。
SELECT rolname as owner,
nspname as schema,
case defaclobjtype
when 'r' then 'table'
when 'S' then 'sequence'
when 'f' then 'function'
when 'T' then 'type'
when 'n' then 'schema'
else 'other'
end as type,
defaclacl as access_privileges
FROM pg_default_acl acl
JOIN pg_namespace ON acl.defaclnamespace = pg_namespace.oid
JOIN pg_authid on acl.defaclrole = pg_authid.oid
order by owner, schema, type
;
実行結果の例:
rolename=xxxx -- privileges granted to a role
=xxxx -- privileges granted to PUBLIC
r -- SELECT ("read")
w -- UPDATE ("write")
a -- INSERT ("append")
d -- DELETE
x -- REFERENCES
t -- TRIGGER
X -- EXECUTE
U -- USAGE
C -- CREATE
c -- CONNECT
T -- TEMPORARY
arwdxt -- ALL PRIVILEGES (for tables)
* -- grant option for preceding privilege
/yyyy -- role that granted this privilege
Author And Source
この問題について(PostgreSQL: デフォルトの権限を確認するSQL), 我々は、より多くの情報をここで見つけました https://qiita.com/suin/items/755a0c822e7612f2d9d3著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .