Re: creation of foreign key without checking prior data? - Mailing list pgsql-general

From Sam Mason
Subject Re: creation of foreign key without checking prior data?
Date
Msg-id 20090917190017.GS5407@samason.me.uk
Whole thread Raw
In response to Re: creation of foreign key without checking prior data?  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
On Thu, Sep 17, 2009 at 08:34:20PM +0200, hubert depesz lubaczewski wrote:
> On Thu, Sep 17, 2009 at 01:22:52PM -0500, Peter Hunsberger wrote:
> > You can't have a foreign key that doesn't have relational integrity,
> > it is no longer a foreign key.
>
> you do realize that having foreign key defined doesn't guarantee
> integrity?

The obvious cases would be software bugs and bad hardware.  What else?
Huh, how about users scribbling over PG's files!  Not sure where to
classify that but could either happen maliciously or accidentally as the
result of trying to clean up.

By having an override here you seem to be saying that you ultimately
trust yourself more than PG and/or the hardware its running on.  I
suppose the trade off is time you *may* spend cleaning up later on if
this isn't true vs. the time PG *will* spend verifying the constraint
now.  Interesting trade off, never really considered it before.

Sounds valid, though the general mantra here is that PG knows best.  Is
that always true?

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: 'Weird' errors
Next
From: Alan McKay
Date:
Subject: limiting query time and/or RAM