Shows all database objects that depend on, or reference, a specified Oracle-migrated table or view inside PostgreSQL.
Before altering or dropping a table migrated from Oracle, verify which PostgreSQL views, functions, triggers, or foreign keys depend on it to avoid breaking production code.
Use pg_depend
, pg_class
, pg_namespace
, and pg_proc
. These catalogs record every relationship between source and dependent objects.
Join pg_depend
to pg_class
twice—once for the referenced table, once for the dependent object. Filter on classid
and objid
to capture views, materialized views, functions, triggers, indexes, and constraints.
:schema_name and :table_name identify the Oracle table. Optionally add :object_types to limit results to VIEW, FUNCTION, TRIGGER, etc.
Run dependency checks in a transaction and on a read-replica when possible. Export the list to code review tools so application teams can confirm impact before DDL changes.
Yes. Foreign tables created by oracle_fdw
appear in pg_class
; the same dependency logic applies.
Add AND c2.relkind = 'v'
to the WHERE clause.
Query pg_attribute
and match attnum
with pg_depend.refobjsubid
to get column-level usages.
Yes. All listed system catalogs are readable by the rds_superuser
or any role with proper permissions.