Re: One parent record with 3 possible child records

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: One parent record with 3 possible child records
Дата
Msg-id CCFD24A0-A331-4633-AC9A-714F7F18B5DF@gmail.com
обсуждение исходный текст
Ответ на Re: One parent record with 3 possible child records  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: One parent record with 3 possible child records  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql


On May 1, 2024, at 5:24 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Wednesday, May 1, 2024, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:

Let's say that tableMain has a string field called "type" with the following possible values: "residential", "industrial" and "energy". 

This, and have the same column in the other tables, but add a check constraint ensuring only the correct enum value can be specified.  Then your foreign key from the child tables to main is both the ID and the type field.
 
David J.
Presuming the id is unique in parent and child, what’s the value of the type field in the foreign key?  Are you saying the PK on tableMain is (type,id), perhaps for clustering purposes?

В списке pgsql-sql по дате отправления:

Предыдущее
От: Sanjay Minni
Дата:
Сообщение: Re: One parent record with 3 possible child records
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: One parent record with 3 possible child records