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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 6 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

Check out the pg_inherits system catalog:

share|improve this answer

Your Answer


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.