postgresql/contrib/amcheck
Álvaro Herrera 3c83a2a0ac
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: Test gin_index_check on a multicolumn index 2025-06-17 14:14:54 +02:00
sql amcheck: Test gin_index_check on a multicolumn index 2025-06-17 14:14:54 +02: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 Add amcheck extension to contrib. 2017-03-09 16:33:02 -08:00
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 amcheck: Fix checks of entry order for GIN indexes 2025-06-17 14:55:29 +02:00
verify_common.c amcheck: Move common routines into a separate module 2025-03-29 15:14:49 +01:00
verify_common.h Fix typos and grammar in the code 2025-04-19 19:17:42 +09:00
verify_gin.c amcheck: Fix posting tree checks in gin_index_check() 2025-06-17 16:48:11 +02:00
verify_heapam.c Fix a few duplicate words in comments 2025-04-21 10:41:18 +12:00
verify_nbtree.c amcheck: Fix snapshot usage in bt_index_parent_check 2026-01-21 18:55:43 +01:00