postgresql 检查用户的 Postgres 访问权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26917508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Check Postgres access for a user
提问by ryekayo
I have looked into the documentation for GRANT
Found hereand I was trying to see if there is a built-in function that can let me look at what level of accessibility I have in databases. Of course there is:
我已经查看了GRANT
Found here的文档,我试图看看是否有一个内置函数可以让我查看我在数据库中的可访问性级别。当然还有:
\dp
and \dp mytablename
\dp
和 \dp mytablename
But this does not show what my account has access to. I would like to see ALL the tables I have access to. Can anyone tell me if there is a command that can check my level of access in Postgres (whether I have SELECT
, INSERT
, DELETE
, UPDATE
privileges)? And if so, what would that command be?
但这并没有显示我的帐户可以访问的内容。我想查看我有权访问的所有表。谁能告诉我是否有一个命令可以检查我在 Postgres 中的访问级别(我是否有SELECT
, INSERT
, DELETE
,UPDATE
权限)?如果是这样,那个命令是什么?
回答by Mureinik
You could query the table_privileges
table in the information schema:
您可以查询table_privileges
信息架构中的表:
SELECT table_catalog, table_schema, table_name, privilege_type
FROM information_schema.table_privileges
WHERE grantee = 'MY_USER'