Re: creation of foreign key without checking prior data?

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: creation of foreign key without checking prior data?
Дата
Msg-id 20090917190017.GS5407@samason.me.uk
обсуждение исходный текст
Ответ на Re: creation of foreign key without checking prior data?  (hubert depesz lubaczewski <depesz@depesz.com>)
Список 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 по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: 'Weird' errors
Следующее
От: Alan McKay
Дата:
Сообщение: limiting query time and/or RAM