rye*_*ayo 34 postgresql privileges data-dictionary
我在这里查看了GRANTFound 的文档,我试图看看是否有一个内置函数可以让我看看我在数据库中的可访问性级别.当然有:
\dp 和 \dp mytablename
但这并未显示我的帐户有权访问的内容.我想查看我可以访问的所有表.谁能告诉我,如果有,可以检查我的Postgres里的访问权限级别的命令(我是否有SELECT,INSERT,DELETE,UPDATE权限)?如果是这样,该命令会是什么?
Mur*_*nik 72
您可以table_privileges在信息模式中查询表:
SELECT table_catalog, table_schema, table_name, privilege_type
FROM information_schema.table_privileges
WHERE grantee = 'MY_USER'
Run Code Online (Sandbox Code Playgroud)
对于特定数据库上的所有用户,请执行以下操作:
# psql
\c your_database
select grantee, table_catalog, privilege_type, table_schema, table_name from information_schema.table_privileges order by grantee, table_schema, table_name;
Run Code Online (Sandbox Code Playgroud)
小智 5
使用它也可以列出受让人并删除 Postgres PaaS Azure 的(PG_monitor 和 Public)。
SELECT grantee,table_catalog, table_schema, table_name, privilege_type
FROM information_schema.table_privileges
WHERE grantee not in ('pg_monitor','PUBLIC');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
47298 次 |
| 最近记录: |