Re: creation of foreign key without checking prior data?

From: Peter Hunsberger <peter(dot)hunsberger(at)gmail(dot)com>
To: depesz(at)depesz(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creation of foreign key without checking prior data?
Date: 2009-09-17 18:22:52
Message-ID: cc159a4a0909171122q51e1ba7dgfcfba50cc5efb42d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 17, 2009 at 12:44 PM, hubert depesz lubaczewski
<depesz(at)depesz(dot)com> wrote:
> On Thu, Sep 17, 2009 at 12:31:14PM -0500, Peter Hunsberger wrote:
>> On Thu, Sep 17, 2009 at 11:40 AM, hubert depesz lubaczewski
>> <depesz(at)depesz(dot)com> wrote:
>> >
>> > So, since (as we know) foreign keys are not fault-proof, wouldn't it be
>> > good to provide a way to create them without all this time-consuming
>> > check?
>>
>> No.
>>
>> If you don't want the behavior of a foreign key then just don't define
>> a foreign key. Load the data, clean it up, then create the foreign key
>
> I think you are missing the point. Data is clean. It's dump. creation of
> fkey takes time, and i'd like to avoid this delay.

You can't have a foreign key that doesn't have relational integrity,
it is no longer a foreign key. If you don't want the delay then don't
define the key, at least until some point at which you can take the
delay. If there is never such a time then your operational scenario
needs changing, not Postgres...

--
Peter Hunsberger

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2009-09-17 18:30:22 Re: pg_restore -j
Previous Message Scott Marlowe 2009-09-17 18:15:33 Re: pg_restore -j