off-by-one in pg_repack index loop - Mailing list pgsql-hackers

From Lakshmi N
Subject off-by-one in pg_repack index loop
Date
Msg-id CA+3i_M9ytFufvD8Tm0rhpfxuC4XrpgQDBHxM7NJQYxv488JW7w@mail.gmail.com
Whole thread
Responses Re: off-by-one in pg_repack index loop
List 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

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications
Next
From: Amit Kapila
Date:
Subject: Re: Support EXCEPT for TABLES IN SCHEMA publications