[PATCH] Align verify_heapam.c error message offset with test expectations

From: zengman <zengman(at)halodbtech(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Align verify_heapam.c error message offset with test expectations
Date: 2026-01-21 14:37:23
Message-ID: tencent_6D253E6F517F8F85796F0D9D@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I think there might be an issue with the error messages in contrib/amcheck/verify_heapam.c.
The test comment in src/bin/pg_amcheck/t/004_verify_heapam.pl (line 715) clearly states:
```
# Tuple at offset 43 is the successor of this one
```
This indicates that for the test case at offnum == 36, the error message should report "offset 43" (the successor), not "offset 36" (the current tuple).
However, when I updated the test expectation from \d+ wildcard to the exact value offset 43, the test fails.
This makes me wonder whether the current code in verify_heapam.c (lines 777, 793, 799) should be using nextoffnum instead of ctx.offnum.
This would also be consistent with similar error messages at lines 746-747 and 753-754, which use nextoffnum when referring to the produced tuple location.

--
Regards,
Man Zeng
www.openhalo.org

Attachment Content-Type Size
0001-fix-hardcode-offset-43-in-expected-tuple-error-regex.patch application/octet-stream 1.2 KB
0002-fix-update-offset-variable-in-corruption-report-mess.patch application/octet-stream 1.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-01-21 14:46:26 RE: Newly created replication slot may be invalidated by checkpoint
Previous Message Bertrand Drouvot 2026-01-21 14:24:58 Re: Fix accidentally cast away qualifiers