In PostgreSQL for these tables
CREATE TABLE cities (
name text,
population float,
altitude int -- in feet
);
CREATE T
The following statement will retrieve the tables that cities
inherits from. If the table does not inherit from another table, the result will be empty:
select bt.relname as table_name, bns.nspname as table_schema
from pg_class ct
join pg_namespace cns on ct.relnamespace = cns.oid and cns.nspname = 'public'
join pg_inherits i on i.inhrelid = ct.oid and ct.relname = 'cities '
join pg_class bt on i.inhparent = bt.oid
join pg_namespace bns on bt.relnamespace = bns.oid