> Hi,
>
> Attached is v8 of the fix for the "missing chunk number 0 for toast
> value" failures during heap rewrites and non-concurrent index builds.
>
> This is a rebase of Matthias' v7 onto current master, with Rui Zhao's
> two follow-up patches folded in, plus a bit of cleanup and one extra
> fix for a whole-row expression index.
>
> Compared to v7:
>
> - Rebased onto current master (conflict in tableam.h resolved by
> keeping master's slice validation and returning bool with flags).
> - Folded in Rui's 0001 (skipped stashed prior versions are counted as
> removed, not reported as a rewrite failure) and 0002 (cleanup loop
> off-by-ones).
> - Replaced the duplicated goto-heavy sort-path and index-build cleanup
> with a shared heap_inline_recently_dead_toast() helper.
> - Index builds now collect every varlena attribute referenced by the
> index definition, expressions (including whole-row Vars) and the
> predicate, so a whole-row expression index no longer races the same
> way. A new isolation permutation covers that case.
> - Dropped the duplicate recovery TAP test in favor of the dblink
> isolation spec (as the v7 commit message already planned). Added
> sort-path CLUSTER and UPDATE-chain permutations there.
> - Comment / include-order / pgindent cleanup; TOAST_MISSING_OK is now
> (1 << 0).
>
> Verification on current master:
>
> - make check: all 243 tests passed
> - src/test/isolation: all 139 tests passed
> - contrib/dblink isolation: rewrite_stale_xmin passed
> - The same isolation test on unpatched master fails all 11
> permutations with the missing-chunk error (CLUSTER index and sort
> paths, VACUUM FULL, REPACK, CREATE INDEX, whole-row expression
> index; DELETE and UPDATE chains).
>
> CF entry: https://commitfest.postgresql.org/patch/6824/
> I will update it with v8 shortly.
>
> Regards,
> Konstantin
>
>
> On 24/10/2026 18:36, Rui Zhao wrote:
> > Thanks for updating the patch. I tested v7 on 4b97fd15fb4 and found the
> > UPDATE case from my previous mail still fails, plus two cleanup leaks.
> >
> > Attached are 0001 and 0002 on top of v7. All tests I ran passed.