pg_shdepend — PostgreSQL system catalog

The PostgreSQL pg_shdepend system catalog: full column reference (names, types, descriptions), catalog relationships and version support.

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):

  • dbid oid references pg_database.oid
    The OID of the database the dependent object is in, or zero for a shared object
  • classid oid references pg_class.oid
    The OID of the system catalog the dependent object is in
  • objid oid references 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 references pg_class.oid
    The OID of the system catalog the referenced object is in (must be a shared catalog)
  • refobjid oid references any OID column
    The OID of the specific referenced object
  • deptype char
    A code defining the specific semantics of this dependency relationship; see text

Related catalogs

This object references the following other system catalogs:

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.