Inheritance and Named ROW Types

A named ROW type can belong to an inheritance hierarchy, as either a subtype or a supertype. Use the UNDER clause in the CREATE ROW TYPE statement to create a named ROW data type as a subtype of an existing ROW data type.

The supertype must also be a named ROW data type. If you create a named ROW data type under an existing supertype, then the new type name row_type becomes the name of the subtype.

When you create a named ROW type as a subtype, the subtype inherits all fields of the supertype. In addition, you can add new fields to the subtype when you create it. The new fields are specific to the subtype alone.

You cannot substitute a ROW type in an inheritance hierarchy for its supertype or for its subtype. For example, consider a type hierarchy in which person_t is the supertype and employee_t is the subtype. If a column is of type person_t, the column can only contain person_t data. It cannot contain employee_t data. Likewise, if a column is of type employee_t, the column can only contain employee_t data. It cannot contain person_t data.