pg_default_acl
是一个 系统目录 表,存储分配给新创建对象的初始权限,如 ALTER DEFAULT PRIVILEGES
命令定义的那样。
pg_default_acl
在 PostgreSQL 9.0 中添加。
psql
按 PostgreSQL 版本定义
pg_default_acl (PostgreSQL 17)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" PRIMARY KEY, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE CONSTRAINT, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 16)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" PRIMARY KEY, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE CONSTRAINT, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 15)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" PRIMARY KEY, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE CONSTRAINT, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 14)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" PRIMARY KEY, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE CONSTRAINT, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 13)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 12)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | not null | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 11)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 10)
Table "pg_catalog.pg_default_acl" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- defaclrole | oid | | not null | defaclnamespace | oid | | not null | defaclobjtype | "char" | | not null | defaclacl | aclitem[] | | | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.6)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.5)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.4)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.3)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.2)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.1)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
pg_default_acl (PostgreSQL 9.0)
Table "pg_catalog.pg_default_acl" Column | Type | Modifiers -----------------+-----------+----------- defaclrole | oid | not null defaclnamespace | oid | not null defaclobjtype | "char" | not null defaclacl | aclitem[] | Indexes: "pg_default_acl_oid_index" UNIQUE, btree (oid) "pg_default_acl_role_nsp_obj_index" UNIQUE, btree (defaclrole, defaclnamespace, defaclobjtype)
文档: pg_default_acl
更改历史记录
自首次添加以来,此表没有更改。
- PostgreSQL 9.0
- 添加 (提交 249724cb)
示例
postgres=# CREATE SCHEMA someschema; CREATE SCHEMA
postgres=# ALTER DEFAULT PRIVILEGES IN SCHEMA someschema GRANT SELECT ON TABLES TO foo; ALTER DEFAULT PRIVILEGES
postgres=# \ddp Default access privileges Owner | Schema | Type | Access privileges ----------+------------+-------+------------------- postgres | someschema | table | foo=r/postgres (1 row)
postgres=# SELECT * FROM pg_default_acl; defaclrole | defaclnamespace | defaclobjtype | defaclacl ------------+-----------------+---------------+------------------ 10 | 16456 | r | {foo=r/postgres} (1 row)
参考
- PostgreSQL 文档: pg_default_acl
有用链接
- PostgreSQL 维基: DefaultACL - 功能开发讨论