检查用户的Postgres访问权限 [英] Check Postgres access for a user

查看:91
本文介绍了检查用户的Postgres访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了GRANT 的文档。 html rel = noreferrer>此处,我试图查看是否有内置函数可以让我了解数据库中的可访问性级别。当然有:

I have looked into the documentation for GRANT Found here and 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:

\dp \dp mytablename

但这不显示我的帐户可以访问的内容。我想查看我有权访问的所有表。谁能告诉我是否有一个命令可以检查我在Postgres中的访问权限(是否我有 SELECT INSERT 删除更新权限)?如果是这样,该命令将是什么?

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?

推荐答案

您可以查询 table_privileges 表:

SELECT table_catalog, table_schema, table_name, privilege_type
FROM   information_schema.table_privileges 
WHERE  grantee = 'MY_USER'

这篇关于检查用户的Postgres访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆