| From: | Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com> |
|---|---|
| To: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | off-by-one in pg_repack index loop |
| Date: | 2026-04-14 07:34:54 |
| Message-ID: | CA+3i_M9ytFufvD8Tm0rhpfxuC4XrpgQDBHxM7NJQYxv488JW7w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Off-by-one-in-repack-index-loop.patch | application/octet-stream | 853 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-04-14 07:51:55 | Re: Support EXCEPT for TABLES IN SCHEMA publications |
| Previous Message | Peter Smith | 2026-04-14 07:32:31 | Re: Support EXCEPT for TABLES IN SCHEMA publications |