Re: Incorrect comment in get_partition_dispatch_recurse

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Incorrect comment in get_partition_dispatch_recurse
Date: 2018-05-17 01:47:41
Message-ID: CAKJS1f_VwEYVOb_iNwjUbGPjEYKrtXoHkBnwNbw6ZQ506UCRyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17 May 2018 at 13:17, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-05-17 01:52:30 partition -> partitioned
Previous Message David Rowley 2018-05-17 01:38:50 Re: Removing unneeded self joins