Re: Correct implementation of 1:n relationship with n>0?

From: Wolfgang Keller <feliphil(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Correct implementation of 1:n relationship with n>0?
Date: 2013-04-30 18:19:22
Message-ID: 20130430201922.be3c8b2294ccbf48fbff362f@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Wolfgang Keller 2013-04-30 18:25:42 Re: Correct implementation of 1:n relationship with n>0?
Previous Message Vik Fearing 2013-04-30 16:37:50 Re: Correct implementation of 1:n relationship with n>0?