amcheck: Fix snapshot usage in bt_index_parent_check

Álvaro Herrera <alvherre@kurilemu.de>

Commit: df93f94dda51cae1d81526472e41bbde0a089377
Author: Álvaro Herrera <alvherre@kurilemu.de>
Date: 2025-12-04T17:12:08Z
Releases: 18.2
amcheck: Fix snapshot usage in bt_index_parent_check

We were using SnapshotAny to do some index checks, but that's wrong and
causes spurious errors when used on indexes created by CREATE INDEX
CONCURRENTLY.  Fix it to use an MVCC snapshot, and add a test for it.

This problem came in with commit 5ae2087202af, which introduced
uniqueness check.  Backpatch to 17.

Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Backpatch-through: 17
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com

Files

PathChange+/−
contrib/amcheck/t/002_cic.pl modified +23 −0
contrib/amcheck/verify_nbtree.c modified +36 −50
doc/src/sgml/amcheck.sgml modified +1 −1

Documentation touched

Discussion