这些是ie的权限。 my_view
视图
pwx1=# \dp my_view
Access privileges
Schema | Name | Type | Access privileges | Column privileges | Policies
----------+-----------------+------+-----------------------+-------------------+----------
schema_x | my_view | view | user1=arwdDxt/user1 +| |
| | | user2=arwdDxt/user1 +| |
| | | user3=r/user1 | |
,我想以sql形式获得这些赠款:
GRANT SELECT ON TABLE my_view TO user3;
我可以使用pgadmin获得这些资助,但是如果可能的话,希望从psql或命令行执行?
答案 0 :(得分:1)
您可以从pg_class
获取ACL信息,并使用aclexplode
函数进行更漂亮的演示:
SELECT acl.grantor::regrole AS grantor,
acl.grantee::regrole AS grantee,
privilege_type,
is_grantable
FROM pg_catalog.pg_class AS t
CROSS JOIN LATERAL aclexplode(t.relacl) AS acl
WHERE t.oid = 'schema_x.my_view'::regclass;
从长远来看,学习阅读PostgreSQL ACL是一个好主意。