Re: [despammed] copy from file and overwrite existing entries?

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: [despammed] copy from file and overwrite existing entries?
Дата
Msg-id 20050627145211.GA16186@webserv.wug-glas.de
обсуждение исходный текст
Ответ на copy from file and overwrite existing entries?  (Mattes Sarcander <mtsrc@systemausfall.org>)
Ответы Re: [despammed] copy from file and overwrite existing  (Mattes Sarcander <mtsrc@systemausfall.org>)
Список pgsql-novice
am  27.06.2005, um 16:33:59 +0200 mailte Mattes Sarcander folgendes:
> Hi,
> I am really new to database administration, so forgive me if I overlook
> something obvious ;>
>
> 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.


Regards, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

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

Предыдущее
От: Mattes Sarcander
Дата:
Сообщение: copy from file and overwrite existing entries?
Следующее
От: "Celia McInnis"
Дата:
Сообщение: Transactions within plpgsql functions?