Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Peter Childs <Blue(dot)Dragon(at)blueyonder(dot)co(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)
Date: 2003-09-30 00:40:05
Message-ID: 3F78D0E5.7050805@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> I think we need someway of telling postgres to suppress a foreign key check.
>
> Well, the subtext argument here is "do we fix it by providing a way to
> suppress the check, or do we fix it by making the check fast enough to
> be tolerable?"
>
> I think the advantages of choice (b) are obvious --- it doesn't allow
> bogus data to be loaded accidentally, and it doesn't create a problem
> with loading existing 7.3 dump files that don't know how to suppress the
> check.
>
> If we find there is no way to do (b) acceptably well, then and only then
> would I want to consider (a).

I think I can accept it to be the choice of the DBA what to do. Pg_dump
has that kind of options already, one can choose between COPY and INSERT
for example. Why not adding the choice of dumping FKeys as ALTER TABLE
or CREATE CONSTRAINT TRIGGER?

The whole "original" idea (way back a few years ago) of doing it with
the CREATE CONSTRAINT TRIGGER command was, that your "backup" ought to
be consistent anyway. Finding out that your tape contains inconsistent
garbage _after_ your harddisk made that suspicious noise ... is a bit
late, isn't it?

That ALTER TABLE ... ADD CONSTRAINT needs to be improved, because at the
moment it is normally used we cannot make any assumptions about data
consistency, no question. But just because we have such a nice and
allways asked for ALTER TABLE command does not mean we have to force
every DBA of every well maintained and stable system to perform hourly
long nonsense-tests on known-to-be-good data.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-09-30 00:40:47 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)
Previous Message Stephan Szabo 2003-09-30 00:29:38 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2003-09-30 00:40:47 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)
Previous Message Stephan Szabo 2003-09-30 00:29:38 Re: ADD FOREIGN KEY (was Re: [GENERAL] 7.4Beta)