可访问性
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
更改历史记录
- PostgreSQL 9.5
- PostgreSQL 9.1
- 添加列
rolreplication
(提交9b8aff8c)
- 添加列
- PostgreSQL 9.0
- 删除列
rolconfig
(提交2eda8dfb;参见pg_db_role_setting
) - 删除
pg_sync_pg_authid
触发器 (提交a8bb8eb5)
- 删除列
- PostgreSQL 8.1
- 添加 (提交7762619e)
示例
来自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 |
参考文献
- PostgreSQL 文档: pg_authid