I make 3 tables with this senario:
b (id) extends a (id)
and
c (id) references a (id)
i insert one record to table b (id = 1)
and then i try to insert a record in table C (id = 1)
but it is not possible, i get error
(look at the sql statements above)
NOTE
if the C (id) references the b (id) the insert in table C
is possible.
I try this to postgresql 8.1.2 and 8.1.4
above is the exact SQL STATMENTS:
============================================
DROP TABLE a;
DROP TABLE b;
DROP TABLE c;
CREATE TABLE a (id integer primary key);
CREATE TABLE b (id integer primary key) INHERITS (a);
CREATE TABLE c (id integer primary key references a(id));
insert into b values (1);
SELECT * from b;
id
----
1
(1 row)
SELECT * from a;
id
----
1
(1 row)
INSERT INTO c VALUES (1);
ERROR: insert or update on table "c" violates foreign key constraint
"c_id_fkey"
DETAIL: Key (id)=(1) is not present in table "a".
============================================
Thanks
Kostas Maistrelis.