Postgresql 中文操作指南
53.28. pg_init_privs #
目录 pg_init_privs 记录了系统中对象的初始权限信息。数据库中具有非默认(非 NULL)初始权限集的每个对象都有一个条目。
The catalog pg_init_privs records information about the initial privileges of objects in the system. There is one entry for each object in the database which has a non-default (non-NULL) initial set of privileges.
对象可以通过在系统初始化时(由 initdb)设置这些权限或者在 CREATE EXTENSION 期间创建对象且扩展脚本使用 GRANT 系统设置初始权限来拥有初始权限。请注意,系统将在扩展脚本期间自动处理权限记录,并且扩展作者只需要在脚本中使用 GRANT 和 REVOKE 语句即可记录权限。 privtype 列指示初始权限是由 initdb 设置还是在 CREATE EXTENSION 命令期间设置。
Objects can have initial privileges either by having those privileges set when the system is initialized (by initdb) or when the object is created during a CREATE EXTENSION and the extension script sets initial privileges using the GRANT system. Note that the system will automatically handle recording of the privileges during the extension script and that extension authors need only use the GRANT and REVOKE statements in their script to have the privileges recorded. The privtype column indicates if the initial privilege was set by initdb or during a CREATE EXTENSION command.
初始权限由 initdb 设置的对象将有 privtype 为 'i' 的条目,而初始权限由 CREATE EXTENSION 设置的对象将有 privtype 为 'e' 的条目。
Objects which have initial privileges set by initdb will have entries where privtype is 'i', while objects which have initial privileges set by CREATE EXTENSION will have entries where privtype is 'e'.
Table 53.28. pg_init_privs Columns
Table 53.28. pg_init_privs Columns
Column Type Description |
objoid oid (references any OID column) The OID of the specific object |
classoid oid (references pg_class.oid) The OID of the system catalog the object is in |
objsubid int4 For a table column, this is the column number (the objoid and classoid refer to the table itself). For all other object types, this column is zero. |
privtype char A code defining the type of initial privilege of this object; see text |
initprivs aclitem[] The initial access privileges; see Section 5.7 for details |