I want to find all objects (tables, views, ... etc) that have a dependency on a specific table. What is a query I could write in postgres to accomplish this.
You'd need to query the catalog for that. Probably pg_depend:
http://www.postgresql.org/docs/current/static/catalog-pg-depend.html
Incase you ever need it, don't miss the convenience type converter that lets you turn table oids and text into relnames like so:
select 'pg_statistics'::regclass; -- 'pg_statistics'
select 2619::regclass; -- 'pg_statistics' too, on my install
# select refclassid::regclass from pg_depend where classid = 'pg_class'::regclass group by refclassid;
refclassid
--------------
pg_namespace
pg_type
pg_class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.