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.