title: Where to find object dependencies in Postgresql ? (pg_depend)
body: <p>In Postgresql 8.1.23, I want to know on which objects my table is depending.</p>
  
  <p>I did :</p>
  
  <pre><code>SELECT * FROM pg_depend WHERE objid=
    (SELECT oid FROM pg_class WHERE relname = 'prix_articleclient');
   classid |  objid  | objsubid | refclassid | refobjid | refobjsubid | deptype
  ---------+---------+----------+------------+----------+-------------+---------
      1259 | 5877366 |        0 |       2615 |    24605 |           0 | n
  </code></pre>
  
  <p>My question is : what is the object '24605'?
  I searched in dozens of tables, webpages, forums, including stackoverflow, but was not able to find any help.</p>
  
  <p>Any help will therefore be greatly appreciated.</p>
  
  <p>P.S. Note that I tried "\d+ your_table" and "<a href="https://stackoverflow.com/questions/4462908/find-dependent-objects-for-a-table-or-view">Find dependent objects for a table or view</a>" without success</p>
  
  <p>P.P.S. I also tried that, but it seems to lead to nowhere :</p>
  
  <pre><code># SELECT * FROM pg_class WHERE oid = 2615 ;
     relname    | relnamespace | reltype | relowner | relam | relfilenode | reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass |    relacl
   pg_namespace |           11 |   10275 |       10 |     0 |        2615 |             0 |        1 |         5 |             0 |             0 | t           | f           | r       |        3 |         0 |           0 |        0 |        0 |       0 | t          | f          | f           | f              | {=r/postgres}
  
  # SELECT * FROM pg_type WHERE oid=10275;
     typname    | typnamespace | typowner | typlen | typbyval | typtype | typisdefined | typdelim | typrelid | typelem | typinput  | typoutput  | typreceive  |   typsend   | typanalyze | typalign | typstorage | typnotnull | typbasetype | typtypmod | typndims | typdefaultbin | typdefault
   pg_namespace |           11 |       10 |     -1 | f        | c       | t            | ,        |     2615 |       0 | record_in | record_out | record_recv | record_send | -          | d        | x          | f          |           0 |        -1 |        0 |               |
  </code></pre>
  
  <p>P.P.P.S. As suggested by Erwin Brandstetter :</p>
  
  <pre><code>SELECT *, refclassid::regclass AS referenced_class FROM pg_depend
  WHERE objid = 'prix_articleclient'::regclass;"
  </code></pre>
  
  <p>gives this result :</p>
  
  <pre><code> classid |  objid  | objsubid | refclassid | refobjid | refobjsubid | deptype | referenced_class
  ---------+---------+----------+------------+----------+-------------+---------+------------------
      1259 | 5877366 |        0 |       2615 |    24605 |           0 | n       | pg_namespace
  </code></pre>
  
  <p>And then :</p>
  
  <pre><code>SELECT * FROM pg_namespace WHERE oid = 24605;
  </code></pre>
  
  <p>...returns the schema.</p>
  
  <p>Which means this dependency was the schema.</p>