Re: Correct implementation of 1:n relationship with n>0? - Mailing list pgsql-sql

From Wolfgang Keller
Subject Re: Correct implementation of 1:n relationship with n>0?
Date
Msg-id 20130430201922.be3c8b2294ccbf48fbff362f@gmx.net
Whole thread Raw
In response to Correct implementation of 1:n relationship with n>0?  (Wolfgang Keller <feliphil@gmx.net>)
Responses Re: Correct implementation of 1:n relationship with n>0?  (Igor Neyman <ineyman@perceptron.com>)
List 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 by date:

Previous
From: Vik Fearing
Date:
Subject: Re: Correct implementation of 1:n relationship with n>0?
Next
From: Wolfgang Keller
Date:
Subject: Re: Correct implementation of 1:n relationship with n>0?