Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X3REI-000335-9c for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jul 2014 14:46:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X3REH-0000tD-Qc for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jul 2014 14:46:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X3REG-0000t6-SA for pgsql-bugs@postgresql.org; Sat, 05 Jul 2014 14:46:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X3RE9-00072I-WE for pgsql-bugs@postgresql.org; Sat, 05 Jul 2014 14:46:15 +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 s65Ek61n001816; Sat, 5 Jul 2014 10:46:06 -0400 From: Tom Lane To: Greg Stark cc: m.fritz@wisutec.de, PostgreSQL Bugs Subject: Re: BUG #10856: Delete trigger corrupts foreign key integrity In-reply-to: References: <20140704065535.5163.57724@wrigleys.postgresql.org> Comments: In-reply-to Greg Stark message dated "Sat, 05 Jul 2014 03:36:51 -0700" Date: Sat, 05 Jul 2014 10:46:06 -0400 Message-ID: <1815.1404571566@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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Greg Stark writes: > On 5 Jul 2014 06:58, wrote: >> A "before delete" trigger on a child table returning "NULL" prevents records >> from deletion, which violates against the FOREIGN KEY constraint. > Yup, don't do that. I bellringer there are warnings to this effect in the > documentation. > We could implement them internally without using triggers but there are > other advantages to using triggers and so far the feeling is that the > development effort is better spent elsewhere. More to the point, if FK actions did not fire triggers, that would be a significant loss of functionality. There are plenty of applications wherein you'd like to have that, for example for logging purposes. So our choice is that user-written triggers are fired and it's up to you that they not break FK changes. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs