Re: table inheritance and foreign keys

Поиск
Список
Период
Сортировка
От Reece Hart
Тема Re: table inheritance and foreign keys
Дата
Msg-id 1053102193.5829.1022.camel@tallac
обсуждение исходный текст
Ответ на Re: table inheritance and foreign keys  (James Gregory <james@anchor.net.au>)
Ответы Re: table inheritance and foreign keys  (James Gregory <james@anchor.net.au>)
Список pgsql-general
James-

Thanks for your advice.  I think I'll opt for the following approach
instead, but I'm interested to hear of any pitfalls you foresee.

Subtables (for which I wanted to use inherit) will instead contain only
the subtable-specific columns, and in addition contain a foreign key
into the parent table.  A view with insert, update, and delete rules can
emulate the appearance of a full subtable (ie, inherited and
subtable-specific columns).

The upside I see over triggers is that the referential integrity is
still on postgresql's back.  The downside is that I end up with more
tables and views to maintain and an extra join in many cases.

Again, thanks for your advice.  Do you see any reason that the above
sketch wouldn't work to emulate foreign keys into inherited tables?

-Reece

--
Reece Hart, Ph.D.                       rkh@gene.com, http://www.gene.com/
Genentech, Inc.                         650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93                        http://www.in-machina.com/~reece/
South San Francisco, CA  94080-4990     reece@in-machina.com, GPG: 0x25EC91A0


В списке pgsql-general по дате отправления:

Предыдущее
От: Dennis Gearon
Дата:
Сообщение: stupid patent
Следующее
От: Kathy Zhu
Дата:
Сообщение: Re: create db with -E