Re: import ignoring duplicates

Поиск
Список
Период
Сортировка
От Tim Landscheidt
Тема Re: import ignoring duplicates
Дата
Msg-id m3y6fjwepr.fsf@passepartout.tim-landscheidt.de
обсуждение исходный текст
Ответ на import ignoring duplicates  (Mark Fenbers <Mark.Fenbers@noaa.gov>)
Список pgsql-sql
Mark Fenbers <Mark.Fenbers@noaa.gov> wrote:

> I am using psql's \copy command to add records to a database
> from a file.  The file has over 100,000 lines.
> Occasionally, there is a duplicate, and the import ceases
> and an internal rollback is performed.  In other words, no
> data is imported even if the first error occurs near the end
> of the file.

> I am looking for an option/switch to tell psql (or the \copy
> command) to skip over any duplicate key constraint
> viloations and continue to load any data that doesn't
> violate a duplicate key constraint.  Is there such an
> option?

No. You can either disable the constraint temporarily, im-
port the data, fix any duplicates and re-enable the con-
straint, or you can load the data in a temporary table and
then transfer only the valid data. With only 100000 records
I would opt for the latter.

Tim



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

Предыдущее
От: Mark Fenbers
Дата:
Сообщение: import ignoring duplicates
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: import ignoring duplicates