v3-0001-amcheck-fix-missing-corruption-error-in-allequali.patch
application/octet-stream
Filename: v3-0001-amcheck-fix-missing-corruption-error-in-allequali.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v3-0001
Subject: amcheck: fix missing corruption error in allequalimage validation
| File | + | − |
|---|---|---|
| contrib/amcheck/verify_nbtree.c | 9 | 7 |
From b4a55a52fdbbadd8eb8aab4e1d3b66d3beaa2178 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Wed, 25 Feb 2026 10:43:43 +0800
Subject: [PATCH v3] amcheck: fix missing corruption error in allequalimage
validation
In bt_index_check_callback(), amcheck checks that a metapage allequalimage
flag is consistent with _bt_allequalimage(). The ereport(ERROR) was placed
inside the loop that detects whether any key attribute has
rd_opfamily[i] == INTERVAL_BTREE_FAM_OID.
That made error reporting conditional on finding the interval btree
opfamily: mismatches on other opfamilies could be missed.
This fix moves the ereport out of the for loop, so that reports corruption
unconditionally, while keeping the interval-specific hint conditional.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/011ACC9C-CB87-4160-ACE7-4ED57AB86E15@gmail.com
---
contrib/amcheck/verify_nbtree.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c
index b74ab5f7a05..a5c62f2cb5c 100644
--- a/contrib/amcheck/verify_nbtree.c
+++ b/contrib/amcheck/verify_nbtree.c
@@ -336,14 +336,16 @@ bt_index_check_callback(Relation indrel, Relation heaprel, void *state, bool rea
if (indrel->rd_opfamily[i] == INTERVAL_BTREE_FAM_OID)
{
has_interval_ops = true;
- ereport(ERROR,
- (errcode(ERRCODE_INDEX_CORRUPTED),
- errmsg("index \"%s\" metapage incorrectly indicates that deduplication is safe",
- RelationGetRelationName(indrel)),
- has_interval_ops
- ? errhint("This is known of \"interval\" indexes last built on a version predating 2023-11.")
- : 0));
+ break;
}
+
+ ereport(ERROR,
+ (errcode(ERRCODE_INDEX_CORRUPTED),
+ errmsg("index \"%s\" metapage incorrectly indicates that deduplication is safe",
+ RelationGetRelationName(indrel)),
+ has_interval_ops
+ ? errhint("This is known of \"interval\" indexes last built on a version predating 2023-11.")
+ : 0));
}
/* Check index, possibly against table it is an index on */
--
2.50.1 (Apple Git-155)