Re: Foreign Key normalization question

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Matthew Wilson" <matt(at)tplus1(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign Key normalization question
Date: 2008-09-02 20:40:55
Message-ID: dcc563d10809021340i3f67c175yb5b0c5c32c662bac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 2, 2008 at 2:35 PM, Matthew Wilson <matt(at)tplus1(dot)com> wrote:
> On Tue 02 Sep 2008 04:19:41 PM EDT, Scott Marlowe wrote:
>> If the two subordinate tables ALWAYS have to point to the same place,
>> why two tables? Can't a customer have > 1 location? I'm pretty sure
>> IBM has more than one corporate office you could ship things to.
>
> Yeah, so the idea is one customer might have many locations and many
> products. And at each location, some subset of all their products is
> available.

You could have the product_locations have a custid1 and custid2 fields
that reference the two parent tables, and then a check constraing on
product_locations that custid1=custid2

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kynn Jones 2008-09-02 20:46:21 How to create a case-insensitive unique constraint?
Previous Message Matthew Wilson 2008-09-02 20:35:24 Re: Foreign Key normalization question