https://stackoverflow.com/questions/4069718/postgres-insert-if-does-not-exist-already
I would like to check if something exists before inserting it, what should I rely on?
UNIQUE
constraint or INSERT .. INTO .. WHERE NOT EXISTS ..
or maybe both? Is there any other solution?
Is it possible to check if something exists in a separate query and inserting in a separate query in the way that it's atomic? Putting it in a transaction scope maybe?
insert ... on conflict do nothing
and a unique constraint?