On 17 May 2018 at 13:17, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > Or maybe, change the comment to say that even the negative indexes are > 0-based like you pointed out, *but* instead of updating the comment like > you suggest above, change the other index value assignment statement to > not subtract 1 from the list_length by switching order with the > accompanying lappend; like this: > > if (get_rel_relkind(partrelid) != RELKIND_PARTITIONED_TABLE) > { > + pd->indexes[i] = list_length(*leaf_part_oids); > *leaf_part_oids = lappend_oid(*leaf_part_oids, partrelid); > - pd->indexes[i] = list_length(*leaf_part_oids) - 1; > } > else > {
That makes sense. It's probably less confusing that way. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services