Foriegn key to Union query or two tables - Mailing list pgsql-novice

From Phillip J. Allen
Subject Foriegn key to Union query or two tables
Date
Msg-id 3E53C750.60804@attglobal.net
Whole thread Raw
Responses Re: Foriegn key to Union query or two tables
List pgsql-novice
Hi all,

I have two tables 'composition_type' and 'mineral_type'.  Both tables
have a number field for their primary key(comp_id & min_id) and their
primary keys are unique between the two tables.  The third table is
'rock_sample' which has a column 'composition'.  Now the
rock_sample.compsition column can be filled with a with either
compositon_type.comp_id or mineral_type.min_id.  So how can I create a
foreign key for rock_samp.composition referencing
composition_type.comp_id AND mineral_type.min_id?

I know some might/will say why are the two tables not just merged into
one but they are under normal circumstances two different things with
difference mutually exclusive attributes.  Also in other situations I
need them appart.

Any suggestions?  I just tried adding a foreign key referencing a VIEW
with a UNION query and psql just spit it back.

Thanks,

Phillip J. Allen
Consulting Geochemist/Geologist
Lima Peru
e-mail: paallen@attglobal.net



pgsql-novice by date:

Previous
From: Jeff Deroshia
Date:
Subject: Re: getting integer info.
Next
From: Bruno Wolff III
Date:
Subject: Re: Foriegn key to Union query or two tables