Re: BUG #1307: Possible bug inheritance/referential integrity

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Thomas Jacob <jacob(at)internet24(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1307: Possible bug inheritance/referential integrity
Date: 2004-11-06 15:59:56
Message-ID: 20041106075734.A99615@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, 6 Nov 2004, PostgreSQL Bugs List wrote:

> Rows inserted into a table "sub" inherited from a table
> "super" do not seem to exist in the super-table from the point of
> view of the foreign key constraint checker in references to the
> "super"-table, even though a SELECT query displays the rows that
> were inserted into sub also in super, as should be (See example
> provided).
>
> But they should exist, shouldn't they? Or do I simply not
> understand PostgreSQL's inheritance model correctly?
>
> CREATE TABLE super (id INT PRIMARY KEY);
> CREATE TABLE super_ref (id INT REFERENCES super);
> CREATE TABLE sub () INHERITS(super);

Inheritance really just doesn't work very well right now when combined
with constraints.

For example, sub has no primary key and even if you defined one on sub(id)
it wouldn't guarantee that you didn't have duplicates between super and
sub. Foreign keys currently reference as if you said ONLY, so the
references constraint above references only super and not any child.
It needs someone to really put effort into making it better.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-11-06 17:49:18 Re: domain on bit(N) type produces strange results
Previous Message Michael Fuhr 2004-11-06 14:46:51 Re: BUG #1307: Possible bug inheritance/referential integrity