历史版本。 PostgreSQL 9.1 已结束支持。 2016-10-27. 请参阅 当前版本手册.
45.38. pg_shdepend #
目录pg_shdepend记录数据库对象和共享对象之间的依赖关系,例如角色。这些信息使得PostgreSQL可以确保对象在被删除时没有被其他对象引用。
另请参阅pg_depend,它对单个数据库中对象之间的依赖提供了相似的功能。
与大部分其他系统目录不同,pg_shdepend在整个集簇的所有数据库之间共享:在每一个集簇中只有一个pg_shdepend的拷贝,而不是每个数据库一份。
表 45.38. pg_shdepend 列
| Name | Type | References | Description |
|---|---|---|---|
dbid | oid | | The OID of the database the dependent object is in, or zero for a shared object |
classid | oid | | The OID of the system catalog the dependent object is in |
objid | oid | any OID column | The OID of the specific dependent object |
objsubid | int4 | For a table column, this is the column number (the
objid and classid refer to the
table itself). For all other object types, this column is zero.
| |
refclassid | oid | | The OID of the system catalog the referenced object is in (must be a shared catalog) |
refobjid | oid | any OID column | The OID of the specific referenced object |
deptype | char | A code defining the specific semantics of this dependency relationship; see text |
在所有情况下,一条pg_shdepend记录都表示:如果不同时删除依赖对象,就不能删除被引用对象。不过,还存在若干由deptype标识的子类型:
SHARED_DEPENDENCY_OWNER(o)被引用对象(必须是一个角色)是依赖对象的拥有者。
SHARED_DEPENDENCY_ACL(a)被引用对象(必须是角色)出现在依赖对象的 ACL(访问控制列表,即权限列表)中。(不会为对象拥有者创建
SHARED_DEPENDENCY_ACL项,因为对象拥有者无论如何都会有一个SHARED_DEPENDENCY_OWNER项。)SHARED_DEPENDENCY_PIN(p)不存在依赖对象;这种项表示系统本身依赖于被引用对象,因此该对象绝不能删除。这种项只由
initdb创建。用于表示依赖对象的各列包含零。
将来可能还需要其他依赖类型。特别要注意的是,当前定义只支持把角色作为被引用对象。