3.13. pg_depend

The pg_depend table records the dependency relationships between database objects. This information allows DROP commands to find which other objects must be dropped by DROP CASCADE, or prevent dropping in the DROP RESTRICT case.

Table 3-13. pg_depend Columns

NameTypeReferencesDescription
classidoidpg_class.oidThe oid of the system catalog the dependent object is in
objidoidany oid attributeThe oid of the specific dependent object
objsubidint4 For a table attribute, this is the attribute's column number (the objid and classid refer to the table itself). For all other object types, this field is presently zero.
refclassidoidpg_class.oidThe oid of the system catalog the referenced object is in
refobjidoidany oid attributeThe oid of the specific referenced object
refobjsubidint4 For a table attribute, this is the attribute's column number (the refobjid and refclassid refer to the table itself). For all other object types, this field is presently zero.
deptypechar  A code defining the specific semantics of this dependency relationship.

In all cases, a pg_depend entry indicates that the referenced object may not be dropped without also dropping the dependent object. However, there are several subflavors identified by deptype:

Other dependency flavors may be needed in future.