Which Tables have Table Inheritance

I am trying to work with a database on private internet . . . and so I'm "working blindly."

Is there a sql query to see which tables are inherited from another table?

Like when you do a create table statement and you write "inherits (table)" at the end of a create statement. Is there a way to see all tables that have this property?

Upvotes: 0

Views: 44

Answers (1)

lat long
lat long

Reputation: 930

This query will tell about the childs(which are inherited) and their parents (from which they are inherited)

SELECT c.relname AS child, p.relname AS parent
FROM
    pg_inherits JOIN pg_class AS c ON (inhrelid=c.oid)
    JOIN pg_class as p ON (inhparent=p.oid);

Upvotes: 3

Related Questions