postgres/contrib/amcheck
Fujii Masao 88a658a42e amcheck: Improve error message for partitioned index target.
Previously, amcheck could produce misleading error message when
a partitioned index was passed to functions like bt_index_check().
For example, bt_index_check() with a partitioned btree index produced:

    ERROR:  expected "btree" index as targets for verification
    DETAIL:  Relation ... is a btree index.

Reporting "expected btree index as targets" even when the specified
index was a btree was confusing. In this case, the function should fail
since the partitioned index specified is not valid target. This commit
improves the error reporting to better reflect this actual issue. Now,
bt_index_check() with a partitioned index, the error message is:

    ERROR:  expected index as targets for verification
    DETAIL:  This operation is not supported for partitioned indexes.

This commit also applies the following minor changes:

- Simplifies index_checkable() by using get_am_name() to retrieve
   the access method name.

- Changes index_checkable() from extern to static, as it is only used
   in verify_common.c.

- Updates the error code for invalid indexes to
   ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE,
   aligning with usage in similar modules like pgstattuple.

Author: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/8829854bbfc8635ddecd0846bb72dfda@oss.nttdata.com
2025-07-14 20:05:10 +09: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 Run pgperltidy 2025-06-29 21:14:21 -04:00
.gitignore
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--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.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: Improve error message for partitioned index target. 2025-07-14 20:05:10 +09:00
verify_common.h amcheck: Improve error message for partitioned index target. 2025-07-14 20:05:10 +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 amcheck: Improve confusing message 2025-07-01 12:24:17 +02:00
verify_nbtree.c Standardize LSN formatting by zero padding 2025-07-07 13:57:43 +02:00