Re: Foreign key to a view (UNION of two or more tables), any alternative? - Mailing list pgsql-general

From Jose Gonzalez Gomez
Subject Re: Foreign key to a view (UNION of two or more tables), any alternative?
Date
Msg-id 306bf0105061909167c5beebe@mail.gmail.com
Whole thread Raw
In response to Re: Foreign key to a view (UNION of two or more tables), any alternative?  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: Foreign key to a view (UNION of two or more tables),  ("Karl O. Pinc" <kop@meme.com>)
Re: Foreign key to a view (UNION of two or more tables), any alternative?  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
On 6/17/05, Bruno Wolff III <bruno@wolff.to> wrote:
> On Fri, Jun 17, 2005 at 14:35:01 +0200,
>   Jose Gonzalez Gomez <jgonzalez.openinput@gmail.com> wrote:
> >
> > The problem comes when you have questions that may be not applicable
> > (8), or optional (doesn't know, doesn't answer) (9). The easy solution
> > would be to have four tables:
> >
> > yes_no
> > yes_no_not_applicable
> > yes_no_optional
> > yes_no_not_applicable_optional
>
> How about having a table with the valid codes for each question?
> This should be relatively easy maintain and you can easily set up
> a foreign key reference to this table to enforce integrity.
>
There would be no problem in doing so with such an easy case, but
think about having a table with cities (hundred, thousands?) and then
have four copies for each of the above posibilities with its related
maintenance nightmare.

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: [SQL] Set Membership operator -- test group membership
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Foreign key to a view (UNION of two or more tables),