Re: inheritance and FK - Mailing list pgsql-general

From Stephan Szabo
Subject Re: inheritance and FK
Date
Msg-id 20030303122023.J40687-100000@megazone23.bigpanda.com
Whole thread Raw
In response to inheritance and FK  (Oleg Lebedev <oleg.lebedev@waterford.org>)
List pgsql-general
On Mon, 3 Mar 2003, Oleg Lebedev wrote:

> I am trying to create two tables: parent and child. Child inherits from
> the parent and has a foregn key (FK) referencing parent's primary key
> (PK). Suppose parent table has one row with PK = 1 and I have one row in
> the child table with FK=1 and PK=2. Now, I want to insert another row in
> the child table with FK = 2, however it won't let me do this, since
> parent table does not have a record with PK = 2.
> I was expecting that children tables will also be searched when
> verifying a foreign key constraint referencing the parent table.
> Is there a way to force this kind of "hierarchical" foreign key
> constraint check?

Not currently.  Currently the check is applied only to the named table.
In general, inheritance needs alot of work, and we need a comprehensive
plan for all the problems (for example, primary keys also don't inherit).


pgsql-general by date:

Previous
From: Oleg Lebedev
Date:
Subject: inheritance and FK
Next
From: Dennis Gearon
Date:
Subject: Re: almost there on a design