pg_authid

包含数据库角色信息的系统表

pg_authid 是一个包含数据库角色信息的系统目录表。

它取代了以前的系统目录表pg_shadow,后者为了向后兼容性而变成了一个视图

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

可访问性

pg_authid 只能被超级用户读取。 系统目录视图pg_roles 可供非超级用户访问,并提供相同的信息,但用户密码除外。

按 PostgreSQL 版本定义

pg_authid (PostgreSQL 17)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE CONSTRAINT, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 16)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE CONSTRAINT, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 15)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE CONSTRAINT, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 14)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" PRIMARY KEY, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE CONSTRAINT, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 13)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 12)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 oid            | oid                      |           | not null | 
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     | C         |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 11)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     |           |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 10)

                        Table "pg_catalog.pg_authid"
     Column     |           Type           | Collation | Nullable | Default 
----------------+--------------------------+-----------+----------+---------
 rolname        | name                     |           | not null | 
 rolsuper       | boolean                  |           | not null | 
 rolinherit     | boolean                  |           | not null | 
 rolcreaterole  | boolean                  |           | not null | 
 rolcreatedb    | boolean                  |           | not null | 
 rolcanlogin    | boolean                  |           | not null | 
 rolreplication | boolean                  |           | not null | 
 rolbypassrls   | boolean                  |           | not null | 
 rolconnlimit   | integer                  |           | not null | 
 rolpassword    | text                     |           |          | 
 rolvaliduntil  | timestamp with time zone |           |          | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.6)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolbypassrls   | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.5)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolbypassrls   | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.4)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcatupdate   | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.3)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcatupdate   | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.2)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcatupdate   | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.1)

             Table "pg_catalog.pg_authid"
     Column     |           Type           | Modifiers 
----------------+--------------------------+-----------
 rolname        | name                     | not null
 rolsuper       | boolean                  | not null
 rolinherit     | boolean                  | not null
 rolcreaterole  | boolean                  | not null
 rolcreatedb    | boolean                  | not null
 rolcatupdate   | boolean                  | not null
 rolcanlogin    | boolean                  | not null
 rolreplication | boolean                  | not null
 rolconnlimit   | integer                  | not null
 rolpassword    | text                     | 
 rolvaliduntil  | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 9.0)

             Table "pg_catalog.pg_authid"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 rolname       | name                     | not null
 rolsuper      | boolean                  | not null
 rolinherit    | boolean                  | not null
 rolcreaterole | boolean                  | not null
 rolcreatedb   | boolean                  | not null
 rolcatupdate  | boolean                  | not null
 rolcanlogin   | boolean                  | not null
 rolconnlimit  | integer                  | not null
 rolpassword   | text                     | 
 rolvaliduntil | timestamp with time zone | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 8.4)

             Table "pg_catalog.pg_authid"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 rolname       | name                     | not null
 rolsuper      | boolean                  | not null
 rolinherit    | boolean                  | not null
 rolcreaterole | boolean                  | not null
 rolcreatedb   | boolean                  | not null
 rolcatupdate  | boolean                  | not null
 rolcanlogin   | boolean                  | not null
 rolconnlimit  | integer                  | not null
 rolpassword   | text                     | 
 rolvaliduntil | timestamp with time zone | 
 rolconfig     | text[]                   | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Triggers:
    pg_sync_pg_authid AFTER INSERT OR DELETE OR UPDATE ON pg_authid FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger()
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 8.3)

             Table "pg_catalog.pg_authid"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 rolname       | name                     | not null
 rolsuper      | boolean                  | not null
 rolinherit    | boolean                  | not null
 rolcreaterole | boolean                  | not null
 rolcreatedb   | boolean                  | not null
 rolcatupdate  | boolean                  | not null
 rolcanlogin   | boolean                  | not null
 rolconnlimit  | integer                  | not null
 rolpassword   | text                     | 
 rolvaliduntil | timestamp with time zone | 
 rolconfig     | text[]                   | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Triggers:
    pg_sync_pg_authid AFTER INSERT OR DELETE OR UPDATE ON pg_authid FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger()
Tablespace: "pg_global"
    

文档: pg_authid

pg_authid (PostgreSQL 8.2)

             Table "pg_catalog.pg_authid"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 rolname       | name                     | not null
 rolsuper      | boolean                  | not null
 rolinherit    | boolean                  | not null
 rolcreaterole | boolean                  | not null
 rolcreatedb   | boolean                  | not null
 rolcatupdate  | boolean                  | not null
 rolcanlogin   | boolean                  | not null
 rolconnlimit  | integer                  | not null
 rolpassword   | text                     | 
 rolvaliduntil | timestamp with time zone | 
 rolconfig     | text[]                   | 
Indexes:
    "pg_authid_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
    "pg_authid_rolname_index" UNIQUE, btree (rolname), tablespace "pg_global"
Triggers:
    pg_sync_pg_authid AFTER INSERT OR DELETE OR UPDATE ON pg_authid FOR EACH STATEMENT EXECUTE PROCEDURE flatfile_update_trigger()
Tablespace: "pg_global"
    

文档: pg_authid

更改历史记录

示例

来自pg_authid的示例行

postgres=# SELECT * FROM pg_authid WHERE rolname='postgres';
-[ RECORD 1 ]--+---------
oid            | 10
rolname        | postgres
rolsuper       | t
rolinherit     | t
rolcreaterole  | t
rolcreatedb    | t
rolcanlogin    | t
rolreplication | t
rolbypassrls   | t
rolconnlimit   | -1
rolpassword    | 
rolvaliduntil  | 

分类

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

另请参阅

pg_auth_memberspg_rolespg_db_role_settingpg_has_role()pg_get_userbyid()

反馈

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