I would like to add rows from
table1 and see how many conflicts of the type "duplicate key value violates unique constraint" result from this in PostgreSQL.
pkey is a primary key, so there a unique constraint on it. Unfortunately and apparently,
conflict_action does not permit incrementing a counter.
INSERT INTO table1 (pkey, col1, col2) SELECT pkey, col1, col2 FROM table2 ON CONFLICT ...;
So is there another (elegant) way for tackling this either by calculating or retrieving that count?