From: | John Smith <john_smith_45678(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: mass import to table with unique index |
Date: | 2003-01-30 09:41:51 |
Message-ID: | 20030130094151.63302.qmail@web40701.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Cave-Ayland | 2003-01-30 10:25:59 | Re: Ref to last INSERT on a table without OIDs? |
Previous Message | Holger Klawitter | 2003-01-30 08:36:48 | Re: Firewalls and Postgres |