Re: Inheritance on foreign key - Mailing list pgsql-general

From Erik Jones
Subject Re: Inheritance on foreign key
Date
Msg-id 0CC9C7C6-F44D-4530-B185-C8516027F451@engineyard.com
Whole thread Raw
In response to Inheritance on foreign key  (Takeichi Kanzaki Cabrera <tkanzakic@gmail.com>)
Responses Re: Inheritance on foreign key
Re: Inheritance on foreign key
List pgsql-general
On Oct 9, 2009, at 9:57 AM, Takeichi Kanzaki Cabrera wrote:

> Hi everybody, I need your help. I have a hierarchy of tables, and
> other table that has a foreign key with the top table of the
> hierarchy, can I insert a value into the "other" table where the value
> it reference is not on the parent table? (it's in one of its child)

No, foreign key checks do not (yet) follow inheritance hierarchies.
Here's the specific clause in the manual (http://www.postgresql.org/docs/8.4/interactive/ddl-inherit.html
) that covers this:

"All check constraints and not-null constraints on a parent table are
automatically inherited by its children. Other types of constraints
(unique, primary key, and foreign key constraints) are not inherited."

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k






pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: PostgreSQL Conference West, registration closing
Next
From: Dave Huber
Date:
Subject: creating a function with another function