Inheritance of foregn key constraints.

From: Andrzej Mazurkiewicz <andrzej(at)mazurkiewicz(dot)org>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Inheritance of foregn key constraints.
Date: 2014-03-21 10:32:56
Message-ID: 1523734.6NloWteI3S@tata
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2014-03-21 10:47:17 Re: Standby server won't start
Previous Message Rajeev rastogi 2014-03-21 09:03:15 Re: Standby server won't start