From: Tom Lane <tgl@sss.pgh.pa.us>
To: ignas@pow.lt
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6632: "before delete" triggers that delete rows from the same table can invalidate constraints
Date: Mon, 07 May 2012 11:06:10 -0400
Message-ID: <26030.1336403170@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SROJF-000243-S0@wrigleys.postgresql.org>
References: <E1SROJF-000243-S0@wrigleys.postgresql.org>
ignas@pow.lt writes:
> [ you can sabotage foreign key constraints with triggers ]
This is not a bug, it's a "don't do that" issue. The only way to
prevent it would be to not fire triggers during FK operations, or
to somehow restrict what triggers are allowed to do, and either of
those cures would be worse than the disease.
In general, it's bad design to use a BEFORE trigger to propagate changes
to other rows; you should do that in AFTER triggers. See the
documentation.
regards, tom lane
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, ignas@pow.lt
Subject: Re: BUG #6632: "before delete" triggers that delete rows from the same table can invalidate constraints
In-Reply-To: <26030.1336403170@sss.pgh.pa.us>
References: <E1SROJF-000243-S0@wrigleys.postgresql.org> <26030.1336403170@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