top of page
Волнистый абстрактный фон
CerebroSQL

PostgreSQL: depend node

The node shows dependency relationships between the selected table and database objects

PostgreSQL table depend

Displayed information

  • Object name

    • Object type

    • List of used table columns

SELECT v.oid::regclass::text "name", v.oid, 
      a.attname,
       case
         when v.relkind = 'v' then 'view' 
         when v.relkind = 'r' then 'table'
         when v.relkind = 'i' then 'index'
         when v.relkind = 't' then 'toast table'
         when v.relkind = 'S' then 'sequence'
         when v.relkind = 'm' then 'materialized view'
         when v.relkind = 'c' then 'composite'
         when v.relkind = 'f' then 'foreign'
       end "relkind"  ,
       case
         when deptype = 'n' then 'DEPENDENCY_NORMAL'
         when deptype = 'a' then 'DEPENDENCY_AUTO'
         when deptype = 'i' then 'DEPENDENCY_INTERNAL'
         when deptype = 'P' then 'DEPENDENCY_PARTITION_PRI'
         when deptype = 'S' then 'DEPENDENCY_PARTITION_SEC'
         when deptype = 'e' then 'DEPENDENCY_EXTENSION'
         when deptype = 'x' then 'DEPENDENCY_AUTO_EXTENSION'
         when deptype = 'p' then 'DEPENDENCY_PIN'
       end "deptype"
FROM pg_depend d
   JOIN pg_rewrite r
     ON r.oid = d.objid
   JOIN pg_class v
     ON v.oid = r.ev_class       
   LEFT JOIN pg_attribute a on (a.attnum =  d.refobjsubid and a.attrelid = v.oid )
WHERE d.refobjid = $$TABLEOID

bottom of page