Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Rob Wultsch <wultsch(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ... ADD FOREIGN KEY ... NOT ENFORCED
Date: 2011-01-06 08:19:55
Message-ID: 1294301995.19612.15241.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2011-01-05 at 22:05 -0500, Bruce Momjian wrote:
> Robert Haas wrote:
> > On Mon, Dec 13, 2010 at 12:59 AM, Rob Wultsch <wultsch(at)gmail(dot)com> wrote:
> > > On Sun, Dec 12, 2010 at 7:24 PM, Andrew Dunstan <andrew(at)dunslane(dot)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".
> >
> > I couldn't agree more, and that's a great way to put it. The user is
> > in charge. Our job is to prevent the user from *accidentally*
> > shooting themselves in the foot. But if a crocodile is biting their
> > foot off and they want to fire their gun in that direction and take
> > their chances, it's not our job to say "oh, no, you might injure your
> > foot". DBAs hate getting eaten by crocodiles.
>
> Is this a TODO?

The patch I'll be submitting, or getting eaten by crocodiles?

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-01-06 09:09:42 Re: Streaming base backups
Previous Message Jesper Krogh 2011-01-06 07:00:29 Re: crash-safe visibility map, take three