Re: [despammed] copy from file and overwrite existing

Поиск
Список
Период
Сортировка
От Mattes Sarcander
Тема Re: [despammed] copy from file and overwrite existing
Дата
Msg-id 20050627174519.65d1199a@carnivore.local
обсуждение исходный текст
Ответ на Re: [despammed] copy from file and overwrite existing entries?  (Andreas Kretschmer <akretschmer@despammed.com>)
Ответы Re: [despammed] copy from file and overwrite existing  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-novice
Andreas Kretschmer <akretschmer@despammed.com> wrote:

> > I want to import data from a csv file into an existing, non-empty
> > table. My problem is the fact that I get an "ERROR:  duplicate key
> > violates unique constraint", because, as psql correctly grumbles,
> > some entries are already inside the tables. I would like to
> > overwrite these existing entries, as the data from the csv files is
> > newer.
>
> I suggest, use a separate import-table to copy the file in this table.
> After you can work with usual SQL to delete old Records in the
> destination table and insert the new records.

Is there a way to automate this? The table is quite big, I expect some
few hundred duplicate entries.

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

Предыдущее
От: "Celia McInnis"
Дата:
Сообщение: Transactions within plpgsql functions?
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: [despammed] copy from file and overwrite existing