Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av3pr-0004hQ-BP for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Apr 2016 14:19:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1av3pq-0007FH-UE for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Apr 2016 14:19:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1av3pD-0006XM-RW for pgsql-bugs@postgresql.org; Tue, 26 Apr 2016 14:18:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1av3pB-0005lO-1h for pgsql-bugs@postgresql.org; Tue, 26 Apr 2016 14:18:50 +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 u3QEIl8k027919; Tue, 26 Apr 2016 10:18:48 -0400 From: Tom Lane To: zha-vova@yandex.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14114: FK on-delete-cascade trouble In-reply-to: <20160426124445.2722.57235@wrigleys.postgresql.org> References: <20160426124445.2722.57235@wrigleys.postgresql.org> Comments: In-reply-to zha-vova@yandex.ru message dated "Tue, 26 Apr 2016 12:44:45 -0000" Date: Tue, 26 Apr 2016 10:18:47 -0400 Message-ID: <27918.1461680327@sss.pgh.pa.us> X-Pg-Spam-Score: -2.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 zha-vova@yandex.ru writes: > After creating a FK constraint with "on delete cascade" option I got a > problem with before-delete-trigger on a dependent table. This short listing > below will make it clear: This is not a bug, this is expected behavior. If you have a trigger that interferes with the updates commanded by a foreign key cascade query, you'll break the integrity of the FK. The only way we could prevent that is to not run triggers for FK cascade updates; which is a cure worse than the disease, since there are plenty of legitimate reasons why you'd want a table's triggers to fire. Write your triggers more carefully. 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