Foriegn key to Union query or two tables

Поиск
Список
Период
Сортировка
От Phillip J. Allen
Тема Foriegn key to Union query or two tables
Дата
Msg-id 3E53C750.60804@attglobal.net
обсуждение исходный текст
Ответы Re: Foriegn key to Union query or two tables  (Bruno Wolff III <bruno@wolff.to>)
Список 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 по дате отправления:

Предыдущее
От: Jeff Deroshia
Дата:
Сообщение: Re: getting integer info.
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Foriegn key to Union query or two tables