Re: Copy/foreign key contraints

Поиск
Список
Период
Сортировка
От Jan Poslusny
Тема Re: Copy/foreign key contraints
Дата
Msg-id 3DFA00DB.4020609@gingerall.cz
обсуждение исходный текст
Ответ на Copy/foreign key contraints  ("Ken Godee" <ken@perfect-image.com>)
Ответы Re: Copy/foreign key contraints  ("Ken Godee" <ken@perfect-image.com>)
Список pgsql-general
explore options and output of pgdump, it must do it correctly

Ken Godee wrote:
> Being fairly new to postgres I'm trying to find my way
> around this, did some searching and see this has come
> up quite a few times, but..........
>
> table 1: customer.custid primary key
> table 2: transx.custid foreign key
>
> When using COPY to import data I received;
>
> "<unnamed>referential integerity violation-key referenced from
> table transx not found in customer" (fairly vague statement)
>
> I'm sure many know where this is going, but I'll still explain
> what I've tried so far.......
>
> Then created a copy/temp table of transx with no constraints
> and COPY'ed data into it, ran some "where not exists" statements
> against the customer.custid and found no unmatched
> primary/foreign keys. Tried to do an INSERT from the temp table
> into the transx table and still got the referential integerity violation.
> At this point I'm presuming that my data's ok, so now what.....
>
> Drop the foreign key, import data, then add foreign key back?
> But what if there is a real "referential integerity violation"?
> How are others dealing with this or am I just doing something
> wrong?
>
> postgres 7.2.1 / Rh7.3
>
> Also as a side note;
> It would be nice while data import if it
> would just create an exception file and continue the import
> of data with a way to see/count exceptions at the end of import
> with a choice to then process the file and save the exceptions.
>
> Sorry to ramble........
>
> Ken
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


В списке pgsql-general по дате отправления:

Предыдущее
От: "Ken Godee"
Дата:
Сообщение: Copy/foreign key contraints
Следующее
От: Thomas Beutin
Дата:
Сообщение: Re: INDEX suggestion needed