Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to know if a certain PostgreSQL table is a part of any inheritance relationship (i.e. is a parent or a child of other table(s)).

Is there a query for that? Where is the inheritance data stored?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted
SELECT relname 
FROM pg_class c,pg_inherits i 
WHERE c.oid=i.inhrelid;

I am the guy that asked Adam about this, I found a solution so I added it here for future reference of others.

share|improve this answer
add comment

Check out the pg_inherits system catalog: http://www.postgresql.org/docs/9.0/interactive/catalog-pg-inherits.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.