From: Shane Ambler <pgsql@Sheeky.Biz>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: chester c young <chestercyoung@yahoo.com>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Cc: greg.toombs@bluebottle.com
Subject: Re: inheritance
Date: Fri, 09 Mar 2007 11:20:21 +1030
Message-ID: <45F0AF4D.2070907@Sheeky.Biz> (raw)
In-Reply-To: <534635.55952.qm@web31811.mail.mud.yahoo.com>
References: <534635.55952.qm@web31811.mail.mud.yahoo.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pgsql@Sheeky.Biz, rabroersma@yahoo.com, chestercyoung@yahoo.com, greg.toombs@bluebottle.com
Subject: Re: inheritance
In-Reply-To: <45F0AF4D.2070907@Sheeky.Biz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox