Re: Incorrect comment in get_partition_dispatch_recurse

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, 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 14:13:07
Message-ID: 27511.1526566387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> 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.

Maybe what you need is a redesign. This convention seems impossibly
confusing and hence error-prone. What about using a separate bool to
indicate which list the index refers to?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-05-17 14:18:56 Re: [PROPOSAL] Shared Ispell dictionaries
Previous Message Tom Lane 2018-05-17 14:10:41 Re: lazy detoasting