PostgreSQL : dependencies on a schema

deletedependenciespostgresqlschema

I need to delete a schema in my PostgreSQL database. I would like to make sure that the schema is not used in another schema (for instance : this schema is used for a view in another one). Is there a way to list all the dependencies in the rest of the database ?

I have tried DROP SCHEMA mySchema ; but the given list of dependencies is partial…

Many thanks for help !

Best Answer

You can use pg_depend table to resolve that : 

select objid::regclass 
from pg_depend 
where refobjid = (select oid
                  from pg_namespace 
                  where nspname='mySchema');