>>
>> 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