]> git.ipfire.org Git - thirdparty/postgresql.git/commit
amcheck: Fix snapshot usage in bt_index_parent_check
authorÁlvaro Herrera <alvherre@kurilemu.de>
Wed, 21 Jan 2026 17:55:43 +0000 (18:55 +0100)
committerÁlvaro Herrera <alvherre@kurilemu.de>
Wed, 21 Jan 2026 17:55:43 +0000 (18:55 +0100)
commitdcddd69871976aabf99039b72124cf9a67e86d0f
tree7b8be24067e602e839f55f2b63ca0d219ca4339b
parent00410b76d5d07bd082eed3f3dfda3ebb02cd0db0
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.

Backpatch of 6bd469d26aca to branches 14-16.  I previously misidentified
the bug's origin: it came in with commit 7f563c09f890 (pg11-era, not
5ae2087202af as claimed previously), so all live branches are affected.

Also take the opportunity to fix some comments that we failed to update
in the original commits and apply pgperltidy.  In branch 14, remove the
unnecessary test plan specification (which would have need to have been
changed anyway; c.f. commit 549ec201d613.)

Diagnosed-by: Donghang Lin <donghanglin@gmail.com>
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
contrib/amcheck/t/002_cic.pl
contrib/amcheck/verify_nbtree.c
doc/src/sgml/amcheck.sgml