Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED - Mailing list pgsql-hackers

From Rob Wultsch
Subject Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date
Msg-id AANLkTinbciF26yrA-a_vV-fKbqf8=89fTytAfYHsHyCc@mail.gmail.com
Whole thread Raw
In response to Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Sun, Dec 12, 2010 at 7:24 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> In fact it's possible now to disable FK enforcement, by disabling the
> triggers. It's definitely a footgun though. Just the other day I was asked
> how data violating the constraint could have got into the table, and caused
> some surprise by demonstrating how easy this was to produce.

Ugh. I have read the entire pg manual and I did not recall that
footgun.  At least in MySQL disabling fk's is explicit. There is
something to be said for being able to tell the database: "Hey, hold
my beer and watch this, it might be stupid but it is what we are going
to do". The database telling it's user that is a much larger issue
(and yes, MySQL is generally worse). The user at least gets to talk to
db through sql, the database only really gets to talk to the user
through errors and the manual.

The fact that fk checks are implemented by the trigger system somehow
seems "surprising".

-- 
Rob Wultsch
wultsch@gmail.com


pgsql-hackers by date:

Previous
From: Glen Knowles
Date:
Subject: Re: [COMMITTERS] pgsql: Use symbolic names not octal constants for file permission flags
Next
From: Rob Wultsch
Date:
Subject: Re: unlogged tables