X-Original-To: pgsql-general@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5F845476B0B for ; Fri, 16 May 2003 12:23:17 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 76131-04 for ; Fri, 16 May 2003 12:23:12 -0400 (EDT) Received: from genie.gene.com (genie-open.gene.COM [192.12.78.1]) by postgresql.org (Postfix) with ESMTP id A959A476AFA for ; Fri, 16 May 2003 12:23:12 -0400 (EDT) Received: from zappa.gene.com (zappa.gene.com [128.137.1.70]) by genie.gene.com (8.12.9/8.12.8) with ESMTP id h4GGNEMa101184; Fri, 16 May 2003 09:23:14 -0700 (PDT) Received: from tallac.gene.com (tallac.gene.com [128.137.116.213]) by zappa.gene.com (8.11.0/8.11.0) with ESMTP id h4GGNDE2152389; Fri, 16 May 2003 09:23:14 -0700 (PDT) Subject: Re: table inheritance and foreign keys From: Reece Hart To: James Gregory Cc: pgsql-general@postgresql.org In-Reply-To: <1052980983.5672.7.camel@pirate.bridge.anchor.net.au> References: <1052957276.5829.53.camel@tallac> <1052980983.5672.7.camel@pirate.bridge.anchor.net.au> Content-Type: text/plain Organization: Genentech, Inc. Message-Id: <1053102193.5829.1022.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 16 May 2003 09:23:13 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/584 X-Sequence-Number: 42239 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