Thread: reference to inherited column in parent

reference to inherited column in parent

From
"Rumi Szabolcs"
Date:
Hello!

i experienced the following problem with postgresql:

---8<-------------------------------------

=# create table parent (a integer unique not null);
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'parent_a_key' for table 'parent'
CREATE
=# create table child (b integer) inherits (parent);
CREATE
=# create table other (c integer references parent (a));
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE
=# insert into child values (1, 2);
INSERT 53863 1
=# insert into other values (1);
ERROR:  <unnamed> referential integrity violation - key referenced from other not found in parent
=# select * from parent;
 a
---
 1
(1 row)

---8<-------------------------------------

i am really far from having a clue about pgsql, but this doesn't
seem to be the correct behaviour to me, i don't know whether
this is accidental or not...

Regards,

Szabolcs Rumi

Re: reference to inherited column in parent

From
Stephan Szabo
Date:
> i am really far from having a clue about pgsql, but this doesn't
> seem to be the correct behaviour to me, i don't know whether
> this is accidental or not...

See past discussions. Reference constraints are currently not inherited
and refer only to the specified table name.  Inheritance currently needs
alot of work.