How to skip duplicate records while copying from CSV to table in Postgresql using "COPY"

Поиск
Список
Период
Сортировка
Hi,

I am copying the data from a CSV file to a Table using "COPY" command. But one thing that I got stuck, is how to skip
duplicaterecords while copying from CSV to tables. By looking at the documentation, it seems, Postgresql don't have any
inbuilttoo to handle this with "copy" command. By doing Google I got below 1 idea to use temp table. 

http://stackoverflow.com/questions/13947327/to-ignore-duplicate-keys-during-copy-from-in-postgresql

I am also thinking what if I let the records get inserted, and then delete the duplicate records from table as this
postsuggested - http://www.postgresql.org/message-id/37013500.DFF0A64A@manhattanproject.com. 

Both of the solution looks like doing double work. But I am not sure which is the best solution here. Can anybody
suggestwhich approach should I adopt ? Or if any better ideas you guys have on this task, please share. 

Thanks in advance!

--
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as
possible,you are, by definition, not smart enough to debug it. 

--Brian Kernighan


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

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: FW: Constraint exclusion in partitions
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: FW: Constraint exclusion in partitions