Re: mass import to table with unique index

Поиск
Список
Период
Сортировка
От Dann Corbit
Тема Re: mass import to table with unique index
Дата
Msg-id D90A5A6C612A39408103E6ECDD77B8294CD8A3@voyager.corporate.connx.com
обсуждение исходный текст
Ответ на mass import to table with unique index  (John Smith <john_smith_45678@yahoo.com>)
Список pgsql-general
> -----Original Message-----
> From: Shridhar Daithankar
> [mailto:shridhar_daithankar@persistent.co.in]
> Sent: Wednesday, January 29, 2003 11:13 PM
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] mass import to table with unique index
>
>
> On 29 Jan 2003 at 15:00, John Smith wrote:
>
> >
> > 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..

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.  Hence if you have a
batch of 100 identical records, a single record gets inserted.

It's useful for things like creating dictionaries from a large list of
words.

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

Предыдущее
От: Lincoln Yeoh
Дата:
Сообщение: Re: Perl DBI and placeheld values
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: Website troubles