Re: mass import to table with unique index

Поиск
Список
Период
Сортировка
От John Smith
Тема Re: mass import to table with unique index
Дата
Msg-id 20030130094151.63302.qmail@web40701.mail.yahoo.com
обсуждение исходный текст
Ответ на mass import to table with unique index  (John Smith <john_smith_45678@yahoo.com>)
Ответы Re: mass import to table with unique index  (Manfred Koizar <mkoi-pg@aon.at>)
Список pgsql-general

>>
>> Is there a way to mass import (like COPY, INSERT INTO ... SELECT ...) data into
>> an existing table with existing data that has a unique index?
>> Such as importing data with SSNs, and there's a unique index on the SSN column.
>> MySQL has an 'IGNORE' option for mass imports. Any way with PostgreSQL? Or only
>> with an INSERT command for each record?

>I don't understand. Why wouldn't copy work in this case? It does insert only
>and it does check index, if I am not making a mistake.

>I am not sure you want the contraint in place while it is mass importing. You
>can always drop the index, mass import data and recreate index if you are sure
>what you are doing..

COPY aborts after any encountered errors (like the first duplicate record). Creating a unique index (after dropping it) doesn't work either - it bails with a 'column data isn't unique' error.

> I think that what the OP is looking for is the SQL*Server equivalent of
> option IGNORE_DUP_KEY, where if you try to insert a record with that key
> already included, it simply ignores that record.

Exactly :)

John

 



Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

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

Предыдущее
От: Holger Klawitter
Дата:
Сообщение: Re: Firewalls and Postgres
Следующее
От: "Mark Cave-Ayland"
Дата:
Сообщение: Re: Ref to last INSERT on a table without OIDs?