以下是 information_schema.table_privileges 表的一些关键列:
- grantor: 授予权限的角色。
- grantee: 被授予权限的角色。
- table_catalog: 表所属的目录(通常是数据库名称)。
- table_schema: 表所属的模式。
- table_name: 表的名称。
- privilege_type: 授予的权限类型,如 SELECT、INSERT、UPDATE、DELETE、REFERENCES 等。
通过查询 information_schema.table_privileges 表,你可以获取有关特定表的权限信息。以下是一个简单的查询示例,显示了给定表 my_table 授予的所有权限:
SELECT
grantor,
grantee,
table_catalog,
table_schema,
table_name,
privilege_type
FROM
information_schema.table_privileges
WHERE
table_name = 'my_table';
这个查询会返回给定表的权限信息,包括授予权限的角色、被授予权限的角色、表的信息以及具体的权限类型。
请注意,具体的系统表和列名可能有所不同,具体取决于 PostgreSQL 版本和配置。
转载请注明出处:http://www.zyzy.cn/article/detail/8440/PostgreSQL