Re: Incorrect comment in get_partition_dispatch_recurse

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

On Wed, May 16, 2018 at 3:20 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Wed, May 16, 2018 at 2:28 PM, David Rowley
> <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
>> Thanks for committing. Although, I disagree with your tweak:
>>
>> + * 1-based index into the *pds list.
>>
>> I think that's making the same mistake as the last comment did. You
>> think it's 1-based because the index is being set with list_length
>> rather than list_length - 1, but it can do that simply because the
>> item has not been added to the list yet.
>
> Uh, maybe I've got that wrong. We can say 0-based instead if that's
> right. I just didn't want to say that in one case it was 0-based and
> in the other case make no mention.

Hang on, I can't be wrong (famous last words). If the negative
indexes were 0-based, that would mean that the first element of the
list was referenced by -0, which obviously can't be true, because 0 =
-0. In other words, we can't be using 0-based indexing for both the
positive and the negative values, because then 0 itself would be
ambiguous. It's got to be that -1 is the first element of the *pds
list, which means -- AFAICS, anyway -- that the way I phrased it is
correct.

Unless the indexing system actually can't reference the first element
of *pds, and -1 means the second element. But then I think we need a
more verbose explanation here.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-05-17 13:30:28 Re: log_min_messages shows debug instead of debug2
Previous Message Robert Haas 2018-05-17 13:21:00 Re: pg_ugprade test failure on data set with column with default value with type bit/varbit