I'm trying to import words from a CSV file. some of its records are already in the table. My Query is as below:
COPY words(word,definition,category) FROM '/home/username/Downloads/New1Names.csv' DELIMITER ',' CSV;
Word column is unique. I receive an error in case of duplicate as below:
ERROR: duplicate key value violates unique constraint "words_word_u"
DETAIL: Key (word)=(johnson) already exists.
CONTEXT: COPY words, line 1: "word definition is here,male"
UPDATED: You can do it this way