Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR0D9-0008K4-0E for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2014 14:14:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WR0D8-0005A8-GD for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Mar 2014 14:14:14 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR0D6-00058d-Ja for pgsql-hackers@postgresql.org; Fri, 21 Mar 2014 14:14:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR0D1-0005fm-AA for pgsql-hackers@postgresql.org; Fri, 21 Mar 2014 14:14:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2LEE3d8015559; Fri, 21 Mar 2014 10:14:03 -0400 From: Tom Lane To: Andrzej Mazurkiewicz cc: "pgsql-hackers@postgresql.org" Subject: Re: Inheritance of foregn key constraints. In-reply-to: <1523734.6NloWteI3S@tata> References: <1523734.6NloWteI3S@tata> Comments: In-reply-to Andrzej Mazurkiewicz message dated "Fri, 21 Mar 2014 11:32:56 +0100" Date: Fri, 21 Mar 2014 10:14:03 -0400 Message-ID: <15558.1395411243@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 Andrzej Mazurkiewicz writes: > 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. So in other words, somebody could (accidentally or maliciously) break the constraint by dropping one of its implementation triggers. I doubt that's acceptable. > 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. Dropping a child table is going to have much larger problems than that, no? What about the values in the child table --- don't you risk orphaning referencing rows? Or are you only supporting this on the referencing side? In any case, it seems like DROP TABLE could remove the dependency entries for itself, rather than taking the risk of weakening the dependency type. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers