Re: Correct implementation of 1:n relationship with n>0?
От | Wolfgang Keller |
---|---|
Тема | Re: Correct implementation of 1:n relationship with n>0? |
Дата | |
Msg-id | 20130430201922.be3c8b2294ccbf48fbff362f@gmx.net обсуждение исходный текст |
Ответ на | Correct implementation of 1:n relationship with n>0? (Wolfgang Keller <feliphil@gmx.net>) |
Ответы |
Re: Correct implementation of 1:n relationship with n>0?
|
Список | pgsql-sql |
> It hit me today that a 1:n relationship can't be implemented just by a > single foreign key constraint if n>0. I must have been sleeping very > deeply not to notice this. > > E.g. if there is a table "list" and another table "list_item" and the > relationship can be described as "every list has at least one > list_item" (and every list_item can only be part of one list, but > this is trivial). <duck> BTW: If every list_item could be part of any number (>0) of lists, you get a n:m relationship with a join table and then the issue that each list_item has to belong to at least one list arises as well. Maybe there should also be a standard solution documented somewhere for this case, too. </duck> Sincerely, Wolfgang
В списке pgsql-sql по дате отправления: