While reviewing [1], I noticed that check_exclusion_or_unique_constraint occasionally returns false negatives for btree unique indexes during UPSERT operations.
Although this doesn't cause any real issues with INSERT ON CONFLICT, I wanted to bring it to your attention, as it might indicate an underlying problem.
Attached is a patch to reproduce the issue.
make -C src/test/modules/test_misc/ check PROVE_TESTS='t/006_*'
# Failed test 'concurrent INSERTs stderr /(?^:^$)/' # at t/006_concurrently_unique_fail.pl line 26. # 'pgbench: error: client 34 script 0 aborted in command 0 query 0: ERROR: we know 31337 in the index!