how to have postgres ignore inserts with a duplicate key but keep going
问题 I am inserting record data in a collection in memory into postgres and want the database to ignore any record that already exists in the database (by virtue of having the same primary key) but keep going with the rest of my inserts. I'm using clojure and hugsql, btw, but I'm guessing the answer might be language agnostic. As I'm essentially treating the database as a set in this way I may be engaging in an antipattern. 回答1: If you're using Postgres 9.5 or newer (which I assume you are, since