Summary
The catalog pg_shdepend records the dependency relationships between database objects and shared objects, such as roles. This information allows PostgreSQL to ensure that those objects are unreferenced before attempting to delete them.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_shdepend system catalog exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
dbidoidreferencespg_database.oid
The OID of the database the dependent object is in, or zero for a shared objectclassidoidreferencespg_class.oid
The OID of the system catalog the dependent object is inobjidoidreferencesany OID column
The OID of the specific dependent objectobjsubidint4
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.refclassidoidreferencespg_class.oid
The OID of the system catalog the referenced object is in (must be a shared catalog)refobjidoidreferencesany OID column
The OID of the specific referenced objectdeptypechar
A code defining the specific semantics of this dependency relationship; see text
Related catalogs
This object references the following other system catalogs:
dbid→pg_databaseclassid→pg_class
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_shdepend.