Cosa intendi con "da query sql"? Significa SELECT
da pg_inherits
non è abbastanza buono per te?
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);