Brett Rowberry
Brett Rowberry

Reputation: 1050

Table inheritance without new columns

Can PostgreSQL make a child table without any additional columns? I’m thinking of something like a Developer table that inherits from an Employee table. Then, when I insert into Developer, that record will be visible in both Developer and Employee tables. It would be a good way to get away from an IsDeveloper column.

Upvotes: 2

Views: 636

Answers (1)

clemens
clemens

Reputation: 17711

You may let the columns empty when you create the child table:

CREATE TABLE developer () INHERITS (employee);

So developer has no additional columns.

Upvotes: 2

Related Questions