Inheritance of foregn key constraints. - Mailing list pgsql-hackers

From Andrzej Mazurkiewicz
Subject Inheritance of foregn key constraints.
Date
Msg-id 1523734.6NloWteI3S@tata
Whole thread Raw
Responses Re: Inheritance of foregn key constraints.
List pgsql-hackers
http://wiki.postgresql.org/wiki/Todo

Section "Inheritance"

"Allow inherited tables to inherit indexes, UNIQUE constraints, and 
primary/FOREIGN KEYS"

Good Morning.

I started to program a patch for inheritance of the foreign key constraints. 
I. e. after applying the patch FKs are maintained between foreign table 
inheritance tree (master tree) and a given table inheritance tree (detail 
tree).

My patch need one change that might be of significance.
A type of the depencencies (pg_depend) among the FK constraint (pg_constraint) 
and the corresponding "RI_ConstraintTrigger" triggers has to be changed from 
DEPENDENCY_INTERNAL to DEPENDENCY_AUTO.
If this modification is not applied, the detail child table cannot be dropped 
without prevous dropping the whole FK constraint because the removing 
operation depend on the FK constraint of its parent table.

It also requires an end user to remember about a triggers maintaining 
uniqueness of a parent tree key and about consistent unique indexes/PKs.

Currently the patch works for 9.3 release for ALTER TABLE ... ADD CONSTRAINT 
... FOREIGN KEY ...;
ALTER TABLE ... DROP CONSTRAINT .... or DROP TABLE (master or detail root).
This covers my needs.

As soon as the patch is ready, matching postgres standards and tested I would 
like to add it to the distribution.

I have the following questions.

1. Is the community interested in it? So should I continue my work since it 
matches the postgres standards?

2. If the answer is yes, please comment the above change of the dependency 
type.

Kind regards
Andrzej Mazurkiewicz



pgsql-hackers by date:

Previous
From: Rajeev rastogi
Date:
Subject: Re: Standby server won't start
Next
From: Tatsuo Ishii
Date:
Subject: Re: Standby server won't start