<?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.47. pg_shdepend</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-sequence.html" title="52.46. pg_sequence" /><link rel="next" href="catalog-pg-shdescription.html" title="52.48. pg_shdescription" /></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.47. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_shdepend</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-sequence.html" title="52.46. pg_sequence">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-shdescription.html" title="52.48. pg_shdescription">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-SHDEPEND"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.47. <code class="structname">pg_shdepend</code></h2></div></div></div><a id="id-1.10.4.49.2" class="indexterm"></a><p> The catalog <code class="structname">pg_shdepend</code> records the dependency relationships between database objects and shared objects, such as roles. This information allows <span class="productname">PostgreSQL</span> to ensure that those objects are unreferenced before attempting to delete them. </p><p> See also <a class="link" href="catalog-pg-depend.html" title="52.18. pg_depend"><code class="structname">pg_depend</code></a>, which performs a similar function for dependencies involving objects within a single database. </p><p> Unlike most system catalogs, <code class="structname">pg_shdepend</code> is shared across all databases of a cluster: there is only one copy of <code class="structname">pg_shdepend</code> per cluster, not one per database. </p><div class="table" id="id-1.10.4.49.6"><p class="title"><strong>Table 52.47. <code class="structname">pg_shdepend</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_shdepend 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">dbid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-database.html" title="52.15. pg_database"><code class="structname">pg_database</code></a>.oid</code></td><td>The OID of the database the dependent object is in, or zero for a shared object</td></tr><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 (must be a shared catalog)</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">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_shdepend</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">SHARED_DEPENDENCY_OWNER</code> (<code class="literal">o</code>)</span></dt><dd><p> The referenced object (which must be a role) is the owner of the dependent object. </p></dd><dt><span class="term"><code class="symbol">SHARED_DEPENDENCY_ACL</code> (<code class="literal">a</code>)</span></dt><dd><p> The referenced object (which must be a role) is mentioned in the ACL (access control list, i.e., privileges list) of the dependent object. (A <code class="symbol">SHARED_DEPENDENCY_ACL</code> entry is not made for the owner of the object, since the owner will have a <code class="symbol">SHARED_DEPENDENCY_OWNER</code> entry anyway.) </p></dd><dt><span class="term"><code class="symbol">SHARED_DEPENDENCY_POLICY</code> (<code class="literal">r</code>)</span></dt><dd><p> The referenced object (which must be a role) is mentioned as the target of a dependent policy object. </p></dd><dt><span class="term"><code class="symbol">SHARED_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. Note in particular that the current definition only supports roles as referenced objects. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-sequence.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-shdescription.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.46. <code class="structname">pg_sequence</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.48. <code class="structname">pg_shdescription</code></td></tr></table></div></body></html>