The error: duplicate key value violates unique constraint "users_pkey"
I am using Node and PG-Promise
I am bulk inserting a bunk of data into my database. Sometimes, the data already exists so I need to either overwrite it or just ignore that row.
I saw that I can do this:
INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE
But I can't seem to figure out how to do that with PG-Promise when I am bulk inserting.
let users = [...]
const query = pgp.helpers.insert(users, userTable)
What would the syntax look like?