off-by-one in pg_repack index loop
Lakshmi N <lakshmin.jhs@gmail.com>
From: Lakshmi N <lakshmin.jhs@gmail.com>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-14T07:34:54Z
Lists: pgsql-hackers
Attachments
- 0001-Off-by-one-in-repack-index-loop.patch (application/octet-stream) patch 0001
Hi hackers,
foreach_current_index returns a 0-based index so
list_length also takes a 0-based index. Perhaps the
check should be list_length(ind_oids_new) <= pos?
Please find the attached patch.
int pos = foreach_current_index(ind_old);
if (unlikely(list_length(ind_oids_new) < pos))
elog(ERROR, "list of new indexes too short");
ident_idx_new = list_nth_oid(ind_oids_new, pos);
break;
Regards,
Lakshmi
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix off-by-one in repack index loop
- b5f92b8eb439 19 (unreleased) landed
-
Improve compiler code layout in elog/ereport ERROR calls
- 913ec71d682e 14.0 cited