<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>52.18. pg_depend</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-default-acl.html" title="52.17. pg_default_acl" /><link rel="next" href="catalog-pg-description.html" title="52.19. pg_description" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.18. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_depend</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-default-acl.html" title="52.17. pg_default_acl">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 52. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-description.html" title="52.19. pg_description">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-DEPEND"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.18. <code class="structname">pg_depend</code></h2></div></div></div><a id="id-1.10.4.20.2" class="indexterm"></a><p> The catalog <code class="structname">pg_depend</code> records the dependency relationships between database objects. This information allows <code class="command">DROP</code> commands to find which other objects must be dropped by <code class="command">DROP CASCADE</code> or prevent dropping in the <code class="command">DROP RESTRICT</code> case. </p><p> See also <a class="link" href="catalog-pg-shdepend.html" title="52.47. pg_shdepend"><code class="structname">pg_shdepend</code></a>, which performs a similar function for dependencies involving objects that are shared across a database cluster. </p><div class="table" id="id-1.10.4.20.5"><p class="title"><strong>Table 52.18. <code class="structname">pg_depend</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_depend Columns" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Type</th><th>References</th><th>Description</th></tr></thead><tbody><tr><td><code class="structfield">classid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>The OID of the system catalog the dependent object is in</td></tr><tr><td><code class="structfield">objid</code></td><td><code class="type">oid</code></td><td>any OID column</td><td>The OID of the specific dependent object</td></tr><tr><td><code class="structfield">objsubid</code></td><td><code class="type">int4</code></td><td> </td><td> For a table column, this is the column number (the <code class="structfield">objid</code> and <code class="structfield">classid</code> refer to the table itself). For all other object types, this column is zero. </td></tr><tr><td><code class="structfield">refclassid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>The OID of the system catalog the referenced object is in</td></tr><tr><td><code class="structfield">refobjid</code></td><td><code class="type">oid</code></td><td>any OID column</td><td>The OID of the specific referenced object</td></tr><tr><td><code class="structfield">refobjsubid</code></td><td><code class="type">int4</code></td><td> </td><td> For a table column, this is the column number (the <code class="structfield">refobjid</code> and <code class="structfield">refclassid</code> refer to the table itself). For all other object types, this column is zero. </td></tr><tr><td><code class="structfield">deptype</code></td><td><code class="type">char</code></td><td> </td><td> A code defining the specific semantics of this dependency relationship; see text </td></tr></tbody></table></div></div><br class="table-break" /><p> In all cases, a <code class="structname">pg_depend</code> entry indicates that the referenced object cannot be dropped without also dropping the dependent object. However, there are several subflavors identified by <code class="structfield">deptype</code>: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="symbol">DEPENDENCY_NORMAL</code> (<code class="literal">n</code>)</span></dt><dd><p> A normal relationship between separately-created objects. The dependent object can be dropped without affecting the referenced object. The referenced object can only be dropped by specifying <code class="literal">CASCADE</code>, in which case the dependent object is dropped, too. Example: a table column has a normal dependency on its data type. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_AUTO</code> (<code class="literal">a</code>)</span></dt><dd><p> The dependent object can be dropped separately from the referenced object, and should be automatically dropped (regardless of <code class="literal">RESTRICT</code> or <code class="literal">CASCADE</code> mode) if the referenced object is dropped. Example: a named constraint on a table is made autodependent on the table, so that it will go away if the table is dropped. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_INTERNAL</code> (<code class="literal">i</code>)</span></dt><dd><p> The dependent object was created as part of creation of the referenced object, and is really just a part of its internal implementation. A <code class="command">DROP</code> of the dependent object will be disallowed outright (we'll tell the user to issue a <code class="command">DROP</code> against the referenced object, instead). A <code class="command">DROP</code> of the referenced object will be propagated through to drop the dependent object whether <code class="command">CASCADE</code> is specified or not. Example: a trigger that's created to enforce a foreign-key constraint is made internally dependent on the constraint's <code class="structname">pg_constraint</code> entry. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_INTERNAL_AUTO</code> (<code class="literal">I</code>)</span></dt><dd><p> The dependent object was created as part of creation of the referenced object, and is really just a part of its internal implementation. A <code class="command">DROP</code> of the dependent object will be disallowed outright (we'll tell the user to issue a <code class="command">DROP</code> against the referenced object, instead). While a regular internal dependency will prevent the dependent object from being dropped while any such dependencies remain, <code class="literal">DEPENDENCY_INTERNAL_AUTO</code> will allow such a drop as long as the object can be found by following any of such dependencies. Example: an index on a partition is made internal-auto-dependent on both the partition itself as well as on the index on the parent partitioned table; so the partition index is dropped together with either the partition it indexes, or with the parent index it is attached to. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_EXTENSION</code> (<code class="literal">e</code>)</span></dt><dd><p> The dependent object is a member of the <em class="firstterm">extension</em> that is the referenced object (see <a class="link" href="catalog-pg-extension.html" title="52.22. pg_extension"><code class="structname">pg_extension</code></a>). The dependent object can be dropped only via <code class="command">DROP EXTENSION</code> on the referenced object. Functionally this dependency type acts the same as an internal dependency, but it's kept separate for clarity and to simplify <span class="application">pg_dump</span>. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_AUTO_EXTENSION</code> (<code class="literal">x</code>)</span></dt><dd><p> The dependent object is not a member of the extension that is the referenced object (and so should not be ignored by pg_dump), but cannot function without it and should be dropped when the extension itself is. The dependent object may be dropped on its own as well. </p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_PIN</code> (<code class="literal">p</code>)</span></dt><dd><p> There is no dependent object; this type of entry is a signal that the system itself depends on the referenced object, and so that object must never be deleted. Entries of this type are created only by <code class="command">initdb</code>. The columns for the dependent object contain zeroes. </p></dd></dl></div><p> Other dependency flavors might be needed in future. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-default-acl.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-description.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.17. <code class="structname">pg_default_acl</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.19. <code class="structname">pg_description</code></td></tr></table></div></body></html>