Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WQwlA-0008Lr-0H for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2014 10:33:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WQwl8-0002c6-EM for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2014 10:33:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WQwl5-0002bv-TH for pgsql-hackers@postgresql.org; Fri, 21 Mar 2014 10:33:03 +0000 Received: from h1881163181.rev.rootvps.pl ([188.116.3.181]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WQwl2-0001XZ-5w for pgsql-hackers@postgresql.org; Fri, 21 Mar 2014 10:33:03 +0000 Received: from tata.mazurkiewicz.org (localhost.localdomain [127.0.0.1]) by h1881163181.rev.rootvps.pl (Postfix) with ESMTPA id AD05F51E0008 for ; Fri, 21 Mar 2014 11:32:05 +0100 (CET) From: Andrzej Mazurkiewicz To: "pgsql-hackers@postgresql.org" Subject: Inheritance of foregn key constraints. Date: Fri, 21 Mar 2014 11:32:56 +0100 Message-ID: <1523734.6NloWteI3S@tata> User-Agent: KMail/4.12.2 (Linux/3.13.0-10-generic; KDE/4.12.2; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers