Thread: PLEASE help with foreign key and inheritance problem

PLEASE help with foreign key and inheritance problem

From
Horst Herb
Date:
I stated this before, but I did not get a helpful answer. I might have 
misunderstood tghe documentation on foreign keys:

create table global(id serial);
create table child(anything text) inherits(global);
insert into child(anything) values ('test);

Now, a select * from child shows
id    anything
-------------
1    test

So far, so good.

create table dependend(globid int4 references child(id) on update cascade on 
delete cascade);

gives me an error: 
CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR:  UNIQUE constraint matching given keys for referenced table "child" 
not found  

Once again, _why_ is this? What would inheritance be good for if I can't use 
it this way? Bad enough that inheritance of triggers or constraints doesn't 
work, but a simple refernce to a attribute should be possible, shouldn't it?

If there is a good reason not to allow it, I would like to know. If not, I 
would be willing to help out implementing it, if somebody points me into the 
right direction in the code (or documentation)

Horst