↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

支持中的版本: 当前版本 (18) / 17 / 16 / 15 / 14
开发中的版本: 19 / 20devel
已结束支持的版本: 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1
历史版本。 PostgreSQL 9.1 已结束支持。 2016-10-27. 请参阅 当前版本手册.

45.38. pg_shdepend #

目录pg_shdepend记录数据库对象和共享对象之间的依赖关系,例如角色。这些信息使得PostgreSQL可以确保对象在被删除时没有被其他对象引用。

另请参阅pg_depend,它对单个数据库中对象之间的依赖提供了相似的功能。

与大部分其他系统目录不同,pg_shdepend在整个集簇的所有数据库之间共享:在每一个集簇中只有一个pg_shdepend的拷贝,而不是每个数据库一份。

表 45.38. pg_shdepend 列

NameTypeReferencesDescription
dbidoidpg_database.oidThe OID of the database the dependent object is in, or zero for a shared object
classidoidpg_class.oidThe OID of the system catalog the dependent object is in
objidoidany OID columnThe OID of the specific dependent object
objsubidint4  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.
refclassidoidpg_class.oidThe OID of the system catalog the referenced object is in (must be a shared catalog)
refobjidoidany OID columnThe OID of the specific referenced object
deptypechar  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创建。用于表示依赖对象的各列包含零。

将来可能还需要其他依赖类型。特别要注意的是,当前定义只支持把角色作为被引用对象。

报告文档问题

阅读 上游文档. 反馈更正前请先核对 当前版本手册.