Re: BUG #1307: Possible bug inheritance/referential integrity - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: BUG #1307: Possible bug inheritance/referential integrity
Date
Msg-id 20041106075734.A99615@megazone.bigpanda.com
Whole thread Raw
In response to BUG #1307: Possible bug inheritance/referential integrity  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
List 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.

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: BUG #1307: Possible bug inheritance/referential integrity
Next
From: Tom Lane
Date:
Subject: Re: domain on bit(N) type produces strange results