Re: Copy/foreign key contraints

Поиск
Список
Период
Сортировка
От Ken Godee
Тема Re: Copy/foreign key contraints
Дата
Msg-id 3DFDB276.19159.E9B885@localhost
обсуждение исходный текст
Ответ на Copy/foreign key contraints  ("Ken Godee" <ken@perfect-image.com>)
Список pgsql-general
Thanks for everyones feedback but.......

Once again I find myself "Eating crow"

Had nothing to do with postgres, my "not exists" statement
was wrong and didn't find the missing data. After correctly
writting the not exsists statement about 30 rows appeared
in the table with the foreign key with no matches from the
table with the primary key.

> 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 по дате отправления:

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: array variables
Следующее
От: Ericson Smith
Дата:
Сообщение: Error while restoring data