Re: Partial foreign keys, check constraints and inheritance

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: Eric E <whalesuit(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Partial foreign keys, check constraints and inheritance
Date: 2005-11-18 03:33:42
Message-ID: 87hdaar5nt.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On 11/17/05, Eric E <whalesuit(at)gmail(dot)com> wrote:
> >
> > What's the best way to do this? My immediate reaction is that I want a
> > partial foreign key, but perhaps this is not a good way to go about such
> > a design.

Normally I just have multiple columns with all but one NULL.

Alternatively you can make it a many-to-many relationship. So you have a
problem table and then you have a problem_product, problem_customer, and a
problem_order table.

--
greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Mitchell 2005-11-18 03:43:55 Re: Strange slow database
Previous Message Tom Lane 2005-11-18 03:28:29 Re: Strange slow database