Re: pg_restore and create FK without verification check

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_restore and create FK without verification check
Date: 2003-11-26 17:24:38
Message-ID: 87ptffvy95.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


ow <oneway_111(at)yahoo(dot)com> writes:

> --- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Quite honestly, I think they should check their foreign keys.

What should I do if I *know* there will be a FK failure but I want to correct
it manually. Perhaps by creating all the necessary target records, perhaps by
deleting or updating the dead references. Perhaps with a mix of these.

As it stands I have to delete the FK constraint, load the table, and fix the
data. Then recreate the FK constraint -- with the danger that I'll get the
definition wrong -- and wait for the constraint to be verified.

If I could disable and reenable the constraint the danger that I would get the
definition wrong would be eliminated. And if I had already done the work to
ensure there were no broken relationships I would optionally be able to skip
the redundant automatic check. I could even have done the verification myself
while the data wasn't live for example.

The database is a tool. It's annoying to have a tool that tries to outsmart
the user.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2003-11-26 17:35:59 Re: pg_restore and create FK without verification check
Previous Message Hannu Krosing 2003-11-26 17:19:34 Re: Materialized views proposal