pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <stark@mit.edu>
Cc: m.fritz@wisutec.de
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #10856: Delete trigger corrupts foreign key integrity
Date: Sat, 05 Jul 2014 10:46:06 -0400
Message-ID: <1815.1404571566@sss.pgh.pa.us> (raw)
In-Reply-To: <CAM-w4HOCxde9LV_j8ipvLSwojQQ-6Mf0Fy0U=J=CZqCOYxs13w@mail.gmail.com>
References: <20140704065535.5163.57724@wrigleys.postgresql.org>
	<CAM-w4HOCxde9LV_j8ipvLSwojQQ-6Mf0Fy0U=J=CZqCOYxs13w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Greg Stark <stark@mit.edu> writes:
> On 5 Jul 2014 06:58, <m.fritz@wisutec.de> 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



view thread (3+ messages)

Message-ID: <1815.1404571566@sss.pgh.pa.us>
Permalink:  ../1815.1404571566@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1815.1404571566@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stark@mit.edu, m.fritz@wisutec.de
  Subject: Re: BUG #10856: Delete trigger corrupts foreign key integrity
  In-Reply-To: <1815.1404571566@sss.pgh.pa.us>
  References: <20140704065535.5163.57724@wrigleys.postgresql.org> <CAM-w4HOCxde9LV_j8ipvLSwojQQ-6Mf0Fy0U=J=CZqCOYxs13w@mail.gmail.com> <1815.1404571566@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox