[BUG?] check_exclusion_or_unique_constraint false negative - Mailing list pgsql-hackers

From Michail Nikolaev
Subject [BUG?] check_exclusion_or_unique_constraint false negative
Date
Msg-id CANtu0oiktqQ2pwExoXqDpByXNCJa-KE5vQRodTRnmFHN_+qwHg@mail.gmail.com
Whole thread Raw
Responses Re: [BUG?] check_exclusion_or_unique_constraint false negative
List pgsql-hackers
Hello, everyone!

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 status (got 2 vs expected 0)'
#   at t/006_concurrently_unique_fail.pl line 26.

#   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!

Best regards,
Mikhail,

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: race condition in pg_class
Next
From: "Andrey M. Borodin"
Date:
Subject: Re: Amcheck verification of GiST and GIN