Обсуждение: mutually exclusive subtypes

Поиск
Список
Период
Сортировка

mutually exclusive subtypes

От
"Olinga K. Abbott"
Дата:
Let's say I have the following contrived schema:

TRANSPORTATION_MODE
modeID serial
model_number text

AIRPLANE
airplaneID serial
operational_ceiling int
modeID int FK

AUTOMOBILE
automobileID serial
cruising range int
modeID int FK

Of course, being an airplane and being an automobile are mutually exclusive.
How does one program the mutual exclusivity in PostgreSQL? I've studied using
check contraints, triggers, and rules, but I'm not finding any obvious way to
program this.