Apa maksudmu "dari kueri sql"? Apakah artinya SELECT
ing dari pg_inherits
tidak cukup baik untukmu?
SELECT pg_inherits.*, 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);