Re: multiple tables as a foreign key

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple tables as a foreign key
Date: 2011-02-21 05:40:18
Message-ID: 4D61FAC2.8000500@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/20/11 2:40 PM, matty jones wrote:
> If I were to create three separate attributes for each of
> the separate titles in the seriestitle table then reference those
> attributes from their respective tables that would produce errors I
> believe, because a foreign key can't be null and not every attribute
> will have a value in every tuple.

a foreign key reference most certainly can be NULL, unless you've
declared it NOT NULL.

The correct answer is as many separate attributes as there are different
tables you want to reference, some of which might be NULL.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-02-21 05:44:22 Re: password
Previous Message Sachin Srivastava 2011-02-21 05:15:14 Re: password