Re: table inheritance and foreign keys

From: Reece Hart <rkh(at)gene(dot)COM>
To: James Gregory <james(at)anchor(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table inheritance and foreign keys
Date: 2003-05-16 16:23:13
Message-ID: 1053102193.5829.1022.camel@tallac
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gene(dot)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(at)in-machina(dot)com, GPG: 0x25EC91A0

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kathy Zhu 2003-05-16 16:37:26 Re: create db with -E
Previous Message Dennis Gearon 2003-05-16 15:58:12 stupid patent