pg_auth_members

包含数据库组信息的系统表

pg_auth_members 是一个包含数据库组信息的系统目录表。

它取代了以前的系统目录表pg_group,后者现在是一个视图

此表在集群中的所有数据库之间共享。

psql 命令

  • \du 提供数据库用户及其角色成员资格的列表
  • \du+ 提供与\du相同的信息,以及用户的描述

系统函数

系统函数pg_has_role() 可用于确定特定用户是否为特定角色的成员。

按 PostgreSQL 版本定义

pg_auth_members (PostgreSQL 17)

            Table "pg_catalog.pg_auth_members"
     Column     |  Type   | Collation | Nullable | Default 
----------------+---------+-----------+----------+---------
 oid            | oid     |           | not null | 
 roleid         | oid     |           | not null | 
 member         | oid     |           | not null | 
 grantor        | oid     |           | not null | 
 admin_option   | boolean |           | not null | 
 inherit_option | boolean |           | not null | 
 set_option     | boolean |           | not null | 
Indexes:
    "pg_auth_members_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_auth_members_grantor_index" btree (grantor), tablespace "pg_global"
    "pg_auth_members_member_role_index" UNIQUE CONSTRAINT, btree (member, roleid, grantor), tablespace "pg_global"
    "pg_auth_members_role_member_index" UNIQUE CONSTRAINT, btree (roleid, member, grantor), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_auth_members

更改历史记录

示例

postgres=# SELECT * FROM pg_auth_members;
 roleid | member | grantor | admin_option 
--------+--------+---------+--------------
   3374 |   3373 |      10 | f
   3375 |   3373 |      10 | f
   3377 |   3373 |      10 | f
(3 rows)

分类

集群范围表系统目录用户和角色

另请参阅

pg_authid

反馈

提交任何关于 "pg_auth_members" 的评论、建议或更正 此处