pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Keller <feliphil@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Correct implementation of 1:n relationship with n>0?
Date: Tue, 30 Apr 2013 20:19:22 +0200
Message-ID: <20130430201922.be3c8b2294ccbf48fbff362f@gmx.net> (raw)
In-Reply-To: <20130430163905.77d43412c0176c3d9ebd8d90@gmx.net>
References: <20130430163905.77d43412c0176c3d9ebd8d90@gmx.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (12+ messages)  latest in thread

Message-ID: <20130430201922.be3c8b2294ccbf48fbff362f@gmx.net>
Permalink:  ../20130430201922.be3c8b2294ccbf48fbff362f@gmx.net/
Also on:    postgresql.org/message-id/20130430201922.be3c8b2294ccbf48fbff362f@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: feliphil@gmx.net
  Subject: Re: Correct implementation of 1:n relationship with n>0?
  In-Reply-To: <20130430201922.be3c8b2294ccbf48fbff362f@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox