Thread: BUG #1146: REFERENCES doesn't work on Inherited Tables

BUG #1146: REFERENCES doesn't work on Inherited Tables

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1146
Logged by:          Gábor Katona

Email address:      katonag@dragon.klte.hu

PostgreSQL version: 7.3.4

Operating system:   Cygwin

Description:        REFERENCES doesn't work on Inherited Tables

Details:

  The inserting of a row into a table doesn't reflect in the mother table
when the mother table is referenced from a third one.

Example
'a' is the mother table, 'b' is the child, and there is a reference to 'a'
in table 'c'

create table a( id INT UNIQUE, name VARCHAR);
create table b( foofoo INT) INHERITS(a);
create table c (id INT UNIQUE, bar INT, foo  INT REFERENCES "a"("id"));

insert into b VALUES (1,'first',0);
insert into b VALUES (2,'second',3);

Then inserting into 'c'

insert into c values (1,3,2);

and the result is unfortunately:
$1 referential integrity violation - key referenced from c not found in a

which means, that id=2 is not in table 'a'.