Hi Bharath, +1 for the patch. The fix looks right to me.
The new test fails on master with CONTEXT: while scanning relation "public.nbtree_vacuum_error_context" and passes with the patch. The same holds for an error in the cleanup pass, an index pass in the middle of the heap scan (master says "while scanning block 1 of relation"), and an error relayed from a worker. With the patch all of them name the index, and the worker error no longer ends with the stale "while scanning relation" line. One Nit: The test only covers bulk delete. The cleanup pass reports "while cleaning up index" and is not tested. A BRIN index on an expression that raises an error hits it, since BRIN cleanup summarizes the new ranges. Thanks, Shihao
