postgresql/contrib/amcheck
Álvaro Herrera 1f28982e40
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 6bd469d26a to branches 14-16.  I previously misidentified
the bug's origin: it came in with commit 7f563c09f8 (pg11-era, not
5ae2087202 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
2026-01-21 18:55:43 +01:00
..
expected amcheck: Improve error message for partitioned index target. 2025-07-14 20:05:10 +09:00
sql amcheck: Improve error message for partitioned index target. 2025-07-14 20:05:10 +09:00
t amcheck: Fix snapshot usage in bt_index_parent_check 2026-01-21 18:55:43 +01:00
.gitignore Add .gitignore to contrib/amcheck. 2017-03-09 22:45:24 -05:00
amcheck--1.0--1.1.sql Add amcheck verification of heap relations belonging to btree indexes. 2018-03-31 19:52:01 -07:00
amcheck--1.0.sql
amcheck--1.1--1.2.sql Allow amcheck to re-find tuples using new search. 2019-03-20 10:41:36 -07:00
amcheck--1.2--1.3.sql Extend amcheck to check heap pages. 2020-10-22 08:44:18 -04:00
amcheck--1.3--1.4.sql Teach contrib/amcheck to check the unique constraint violation 2023-10-28 00:21:23 +03:00
amcheck--1.4--1.5.sql amcheck: Add gin_index_check() to verify GIN index 2025-03-29 15:44:29 +01:00
amcheck.control amcheck: Add gin_index_check() to verify GIN index 2025-03-29 15:44:29 +01:00
Makefile amcheck: Add gin_index_check() to verify GIN index 2025-03-29 15:44:29 +01:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
verify_common.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
verify_common.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
verify_gin.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
verify_heapam.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
verify_nbtree.c amcheck: Fix snapshot usage in bt_index_parent_check 2026-01-21 18:55:43 +01:00