Copy/foreign key contraints

Поиск
Список
Период
Сортировка
От Ken Godee
Тема Copy/foreign key contraints
Дата
Msg-id 3DF996D2.759.314A8B@localhost
обсуждение исходный текст
Ответы Re: Copy/foreign key contraints  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: Copy/foreign key contraints  ("Ken Godee" <ken@perfect-image.com>)
Список pgsql-general
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















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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: 'vacation' flag for the list?
Следующее
От: Jan Poslusny
Дата:
Сообщение: Re: Copy/foreign key contraints