Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C2EB29FC1CB for ; Thu, 8 Mar 2007 20:50:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 58105-09 for ; Thu, 8 Mar 2007 20:50:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by postgresql.org (Postfix) with ESMTP id E438E9FC1C3 for ; Thu, 8 Mar 2007 20:50:27 -0400 (AST) Received: from ppp247-71.static.internode.on.net (HELO [192.168.8.200]) ([203.122.247.71]) by ipmail02.adl2.internode.on.net with ESMTP; 09 Mar 2007 11:20:24 +1030 X-IronPort-AV: i="4.14,265,1170595800"; d="scan'208"; a="95235982:sNHT47428031" Message-ID: <45F0AF4D.2070907@Sheeky.Biz> Date: Fri, 09 Mar 2007 11:20:21 +1030 From: Shane Ambler User-Agent: Thunderbird 1.5.0.10 (Macintosh/20070221) MIME-Version: 1.0 To: Richard Broersma Jr CC: chester c young , sql pgsql , greg.toombs@bluebottle.com Subject: Re: inheritance References: <534635.55952.qm@web31811.mail.mud.yahoo.com> In-Reply-To: <534635.55952.qm@web31811.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.051 tagged_above=0 required=5 tests=AWL, BAYES_50, BIZ_TLD, SPF_HELO_PASS X-Spam-Level: ** X-Archive-Number: 200703/93 X-Sequence-Number: 27731 Richard Broersma Jr wrote: >> Maybe then you'll add a table basket that has a foreign key to the fruit >> table....... ;-) > >>From the inheritance link: > ... > A serious limitation of the inheritance feature is that indexes (including unique constraints) and > foreign key constraints only apply to single tables, not to their inheritance children. This is > true on both the referencing and referenced sides of a foreign key constraint. > ... > > You can create a foreign key to the fruit table to a table basket, but this foreign key will only > work for fruit that was directly inserted into the fruit table. Any fruit inserted into the > Apples or Oranges table can not be referenced by the table basket. I believe that this limitation > in table inheritance will not work for Greg's requirements. > > > Having said this, it would make me very happy if I am wrong. I hate modeling data the hard way > when there is a better way of doing it. ;) You can get and store related records but the issue is that you need to maintain referential integrity yourself instead of postgresql doing it for you. So currently your right, next release or two maybe not. There is a current discussion (on hackers list) on partitioning that has been going over ways to tackle the primary / unique constraints across multiple child tables and that could lead to a solution that can be applied to this as well. Partitioning is using inheritance to spread data across multiple tables. eg you may have one table for each month's worth of data. -- Shane Ambler pgSQL@Sheeky.Biz Get Sheeky @ http://Sheeky.Biz