CREATE TABLE people (
    id serial primary key,
    name text
);
 
CREATE TABLE scientists (
    university text
) INHERITS (people);
 
CREATE TABLE chefs (
    hat_size text
) INHERITS (people);
 
CREATE TABLE people_i_like (
    person_id integer references people(id),
    reason text
);
 
insert into scientists    values (default, 'Alice', 'MIT');
insert into chefs         values (default, 'Bob', 'medium');
 
insert into people_i_like values (1, 'taught me math');
--ERROR:  insert or update on table "people_i_like" violates foreign key constraint "people_i_like_people_id_fkey"
--DETAIL:  Key (person_id)=(1) is not present in table "people".